|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + # No inputs - when you trigger, it releases |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write # Push branches/tags |
| 9 | + |
| 10 | +jobs: |
| 11 | + release: |
| 12 | + name: Release |
| 13 | + runs-on: ubuntu-latest |
| 14 | + # Only allow running from develop branch |
| 15 | + if: github.ref == 'refs/heads/develop' |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/create-github-app-token@v1 |
| 19 | + id: app-token |
| 20 | + with: |
| 21 | + app-id: ${{ secrets.APP_ID }} |
| 22 | + private-key: ${{ secrets.APP_PRIVATE_KEY }} |
| 23 | + |
| 24 | + - name: Checkout develop branch |
| 25 | + uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + ref: develop |
| 28 | + fetch-depth: 0 # Full history for merging |
| 29 | + token: ${{ steps.app-token.outputs.token }} |
| 30 | + |
| 31 | + - name: Setup Node.js |
| 32 | + uses: actions/setup-node@v4 |
| 33 | + with: |
| 34 | + node-version: '24' |
| 35 | + |
| 36 | + - name: Install dependencies |
| 37 | + run: yarn install --immutable |
| 38 | + |
| 39 | + - name: Build |
| 40 | + run: yarn build |
| 41 | + |
| 42 | + - name: Lint |
| 43 | + run: yarn lint |
| 44 | + |
| 45 | + - name: Test |
| 46 | + run: yarn test:unit |
| 47 | + |
| 48 | + - name: Apply release changes |
| 49 | + run: yarn applyReleaseChanges |
| 50 | + |
| 51 | + - name: Get version from package.json |
| 52 | + id: version |
| 53 | + run: | |
| 54 | + VERSION=$(node -p "require('./package.json').version") |
| 55 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 56 | + echo "Release version: $VERSION" |
| 57 | +
|
| 58 | + - name: Configure git |
| 59 | + run: | |
| 60 | + git config user.name "github-actions[bot]" |
| 61 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 62 | +
|
| 63 | + - name: Commit changes if any |
| 64 | + run: | |
| 65 | + git add -A |
| 66 | + if git diff --staged --quiet; then |
| 67 | + echo "No changes to commit" |
| 68 | + else |
| 69 | + git commit -m "chore: release v${{ steps.version.outputs.version }}" |
| 70 | + fi |
| 71 | +
|
| 72 | + - name: Push develop branch |
| 73 | + run: git push origin develop |
| 74 | + |
| 75 | + - name: Merge to master |
| 76 | + run: | |
| 77 | + git checkout master |
| 78 | + git merge develop --no-edit |
| 79 | + git push origin master |
| 80 | +
|
| 81 | + - name: Create and push release tag |
| 82 | + continue-on-error: true |
| 83 | + run: | |
| 84 | + git tag "v${{ steps.version.outputs.version }}" |
| 85 | + git push origin "v${{ steps.version.outputs.version }}" |
| 86 | +
|
| 87 | + # Deployment is handled by Netlify automatically on push to master |
| 88 | + # No manual deployment step needed - Netlify watches the master branch |
| 89 | + # and auto-deploys when changes are detected |
0 commit comments