-
-
Notifications
You must be signed in to change notification settings - Fork 167
84 lines (72 loc) · 2.68 KB
/
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
name: Build Apps, Deploy Web and Create Release
on:
push:
branches:
- inherit # todo remove, can't workflow_dispatch from branch
workflow_call:
inputs:
release_branch_prefix:
description: "Release branch prefix (e.g. `test-release`)"
default: "test-release"
tag_prefix:
description: "Tag prefix (e.g. `test-`)"
default: "test-"
workflow_dispatch:
inputs:
release_branch_prefix:
description: "Release branch prefix (e.g. `test-release`)"
default: ""
tag_prefix:
description: "Tag prefix (e.g. `test-`)"
default: ""
jobs:
validate_version:
name: Update version and push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Get current version from package.json
id: get_current_version
run: |
CURRENT_APP_VERSION=$(node -p "require('./package.json').version")
echo "version=$CURRENT_APP_VERSION" >> $GITHUB_OUTPUT
- name: Verify provided version not already released
run: |
git fetch --tags
TAG_NAME="${{ inputs.tag_prefix }}${{ steps.get_current_version.outputs.version }}"
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
echo "Error: Tag $TAG_NAME already exists"
exit 1
fi
push_release:
needs: validate_version
environment: deploy
name: Add version to apps, push release branch and tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run trapeze (update iOS and Android version/code)
run: pnpm exec trapeze run trapeze.yaml
env:
APP_BUILD: ${{ github.run_number }}
APP_VERSION: ${{ needs.validate_version.outputs.version }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Commit and push release
run: |
git checkout -b ${{ inputs.release_branch_prefix }}/${{ needs.validate_version.outputs.version }}
git config --global user.email "[email protected]"
git config --global user.name "Voyager CI"
git add .
git commit -m "Release ${{ needs.validate_version.outputs.version }} (${{ github.run_number }})"
git tag ${{ inputs.tag_prefix }}${{{ needs.validate_version.outputs.version }}
git push origin HEAD
git push --tags