Skip to content

Commit b331820

Browse files
committed
add api versioning
1 parent 73fc2db commit b331820

File tree

3 files changed

+48
-8
lines changed

3 files changed

+48
-8
lines changed

.github/workflows/api_cd.yaml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,44 @@
11
on:
22
workflow_dispatch:
3-
push:
4-
paths:
5-
- "apps/api/**"
6-
branches:
7-
- main
83

94
jobs:
5+
compute-version:
6+
runs-on: ubuntu-latest
7+
outputs:
8+
version: ${{ steps.version.outputs.version }}
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
fetch-tags: true
14+
- uses: ./.github/actions/doxxer_install
15+
- id: version
16+
run: |
17+
VERSION=$(doxxer --config doxxer.api.toml next patch)
18+
echo "version=$VERSION" >> $GITHUB_OUTPUT
19+
echo "Computed version: $VERSION"
20+
1021
deploy:
22+
needs: compute-version
1123
runs-on: depot-ubuntu-24.04-8
1224
timeout-minutes: 60
1325
concurrency: api-fly-deploy
1426
steps:
1527
- uses: actions/checkout@v4
1628
- uses: superfly/flyctl-actions/setup-flyctl@master
17-
- run: flyctl deploy --config apps/api/fly.toml --remote-only -e APP_REVISION=${{ github.sha }}
29+
- run: flyctl deploy --config apps/api/fly.toml --remote-only -e APP_VERSION=${{ needs.compute-version.outputs.version }}
1830
env:
1931
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
32+
33+
tag:
34+
needs: deploy
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: write
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: mathieudutour/[email protected]
41+
with:
42+
github_token: ${{ secrets.GITHUB_TOKEN }}
43+
custom_tag: api_v${{ needs.compute-version.outputs.version }}
44+
tag_prefix: ""

.github/workflows/desktop_cd.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ env:
2222

2323
jobs:
2424
compute-version:
25-
runs-on: depot-ubuntu-24.04-8
25+
runs-on: ubuntu-latest
2626
outputs:
2727
version: ${{ steps.version.outputs.version }}
2828
steps:
@@ -47,7 +47,7 @@ jobs:
4747
cn-draft:
4848
if: ${{ inputs.channel != 'staging' }}
4949
needs: compute-version
50-
runs-on: depot-ubuntu-24.04-8
50+
runs-on: ubuntu-latest
5151
steps:
5252
- uses: actions/checkout@v4
5353
- run: ./scripts/version.sh "./apps/desktop/src-tauri/tauri.conf.json" "${{ needs.compute-version.outputs.version }}"
@@ -149,6 +149,7 @@ jobs:
149149
VITE_APP_URL: "https://hyprnote.com"
150150
VITE_API_URL: "https://api.hyprnote.com"
151151
VITE_PRO_PRODUCT_ID: ${{ secrets.VITE_PRO_PRODUCT_ID }}
152+
VITE_APP_VERSION: ${{ needs.compute-version.outputs.version }}
152153
- run: |
153154
mkdir -p target/release/
154155
find target/${{ matrix.target }}/release -type f -not -path "*/\.*" -exec cp {} target/release/ \;
@@ -227,6 +228,7 @@ jobs:
227228
VITE_APP_URL: "https://hyprnote.com"
228229
VITE_API_URL: "https://api.hyprnote.com"
229230
VITE_PRO_PRODUCT_ID: ${{ secrets.VITE_PRO_PRODUCT_ID }}
231+
VITE_APP_VERSION: ${{ needs.compute-version.outputs.version }}
230232
- run: |
231233
mkdir -p target/release/
232234
find target/x86_64-unknown-linux-gnu/release -type f -not -path "*/\.*" -exec cp {} target/release/ \;

doxxer.api.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
filter.tag = "^api_v"
2+
3+
[output]
4+
format = "plain"
5+
6+
[next.patch]
7+
increment = 1
8+
9+
[next.minor]
10+
increment = 1
11+
12+
[next.major]
13+
increment = 1

0 commit comments

Comments
 (0)