Workflow file for this run
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: 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`)" | ||
Check failure on line 11 in .github/workflows/release.yml GitHub Actions / Build Apps, Deploy Web and Create ReleaseInvalid workflow file
|
||
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 |