New version release #42
This file contains hidden or 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: New version release | |
| description: Bump version, push to IPFS, and create GitHub Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release-type: | |
| description: 'Type of version bump' | |
| required: true | |
| default: patch | |
| type: choice | |
| options: | |
| - major | |
| - minor | |
| - patch | |
| frontend: | |
| description: 'Which frontend to deploy' | |
| required: true | |
| default: '' # empty by default -> forces manual selection | |
| type: choice | |
| options: | |
| - legacy | |
| - credits | |
| jobs: | |
| build: | |
| name: Build & export static site | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Build and Export | |
| uses: aleph-im/aleph-github-actions/build-nextjs-app@v1 | |
| with: | |
| fa-token: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
| node-version: 25.1.0 | |
| - name: Upload export as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nextjs-export | |
| path: out | |
| if-no-files-found: error | |
| retention-days: 1 | |
| push-to-ipfs: | |
| name: Push site to IPFS | |
| needs: build | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| cid_v0: ${{ steps.push_to_ipfs.outputs.cid_v0 }} | |
| cid_v1: ${{ steps.push_to_ipfs.outputs.cid_v1 }} | |
| steps: | |
| - name: Download export artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nextjs-export | |
| path: out | |
| - name: Push to IPFS | |
| id: push_to_ipfs | |
| uses: aleph-im/aleph-github-actions/[email protected] | |
| with: | |
| upload-dir: out | |
| deploy-app: | |
| name: Deploy to production | |
| needs: push-to-ipfs | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: Install dependencies | |
| run: | | |
| pip install -r scripts/deploy/requirements.txt | |
| shell: bash | |
| - name: Deploy to Aleph | |
| env: | |
| FRONTEND: ${{ inputs.frontend }} | |
| run: | | |
| set -euo pipefail | |
| # Determine app based on selected frontend | |
| case "${FRONTEND}" in | |
| legacy) | |
| APP="${{ vars.DEPLOY_APP }}" | |
| ;; | |
| credits) | |
| APP="${{ vars.DEPLOY_CREDITS_APP }}" | |
| ;; | |
| '') | |
| echo "Error: You must select a frontend (legacy or credits) before running." | |
| exit 1 | |
| ;; | |
| *) | |
| echo "Error: Invalid frontend '${FRONTEND}'. Valid options: legacy, credits." | |
| exit 1 | |
| ;; | |
| esac | |
| python scripts/deploy/client.py \ | |
| --cid ${{ needs.push-to-ipfs.outputs.cid_v0 }} \ | |
| --app "${APP}" \ | |
| --url ${{ vars.DEPLOY_URL }} \ | |
| --key ${{ secrets.DEPLOY_PRIVATE_KEY }} | |
| bump-version: | |
| name: Bump version | |
| needs: [push-to-ipfs, deploy-app] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_tag: ${{ steps.bump_version.outputs.new_tag }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| - name: Bump version | |
| id: bump_version | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor }}@users.noreply.github.com" | |
| NEW_TAG=$(npm version ${{ inputs.release-type }}) | |
| echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT | |
| - name: Push version commit and tag | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
| git push origin HEAD:main | |
| git push origin --tags | |
| create-release: | |
| name: Create GitHub Release | |
| needs: [bump-version, push-to-ipfs] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create GitHub Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ needs.bump-version.outputs.new_tag }} | |
| release_name: Release ${{ needs.bump-version.outputs.new_tag }} | |
| body: | | |
| **IPFS CID:** `${{ needs.push-to-ipfs.outputs.cid_v0 }}` | |
| **Preview:** https://${{ needs.push-to-ipfs.outputs.cid_v1 }}.ipfs.aleph.sh | |
| draft: false | |
| prerelease: false |