edit #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Full | |
permissions: | |
contents: write | |
on: | |
# also run on push to main | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
branches: | |
- main | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup bun 🔧 | |
uses: oven-sh/setup-bun@v2 | |
- name: Install dependencies | |
run: bun install | |
- name: Install pkg | |
run: bun install -g pkg | |
# Bump the version (patch/minor/major) | |
- name: Bump version | |
run: bun run bump | |
# Stage and commit any uncommitted changes (if necessary) | |
- name: Stage and commit uncommitted changes | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
# Push the version bump to the main branch using the PAT | |
- name: Push version bump | |
env: | |
GIT_COMMITTER_NAME: GitHub Action | |
GIT_COMMITTER_EMAIL: [email protected] | |
run: | | |
git commit -am "bumping version" && git push "https://${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository }}" HEAD:main --follow-tags | |
- name: Decode PEM file | |
run: echo "${{ secrets.CERTIFICATE_PEM_BASE64 }}" | base64 --decode > ./akv_test_cert.pem | |
- name: Build | |
run: bun run build | |
- name: Read current version from package.json | |
id: read_version | |
run: echo "PACKAGE_VERSION=$(jq -r .version < package.json)" >> $GITHUB_ENV | |
# Package into zip using Octopus zip package action | |
- name: Create a Zip package 🐙 | |
uses: OctopusDeploy/create-zip-package-action@v3 | |
with: | |
package_id: 'deadlock_backend' | |
version: ${{ env.PACKAGE_VERSION }} | |
output_folder: './artifacts' | |
base_path: './dist' | |
files: 'deadlock_backend' | |
# Push zip package to Octopus | |
- name: Push package to Octopus 🐙 | |
uses: OctopusDeploy/push-package-action@v3 | |
with: | |
api_key: ${{ secrets.OCTOPUS_SERVER_API_KEY }} | |
server: ${{ secrets.OCTOPUS_SERVER_URL }} | |
packages: "./artifacts/deadlock_backend.${{ env.PACKAGE_VERSION }}.zip" | |
space: ${{ secrets.OCTOPUS_SERVER_SPACE }} | |
# simplies echos the github.ref var | |
- name: Echo github.ref | |
run: echo ${{ github.ref }} | |
# Create and deploy release using Octopus Deploy action | |
- name: Deploy a release in Octopus Deploy 🐙 | |
uses: OctopusDeploy/create-release-action@v3 | |
env: | |
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_SERVER_API_KEY }} | |
OCTOPUS_URL: ${{ secrets.OCTOPUS_SERVER_URL }} | |
OCTOPUS_SPACE: ${{ secrets.OCTOPUS_SERVER_SPACE }} | |
with: | |
project: "deadlock-backend" | |
package_version: ${{ env.PACKAGE_VERSION }} | |
environments: | | |
Staging |