-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (76 loc) · 2.82 KB
/
build-and-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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