[Release] Build 94 of branch main by @holloway #94
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: Build and Deploy Website | |
| run-name: ${{ inputs.deploy == 'Skip' && '[Dev]' || '[Release]' }} Build ${{ github.run_number }} of branch ${{ github.ref_name }} by @${{ github.actor }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| deploy: | |
| description: 'Deploy to K8S' | |
| default: 'Skip' | |
| required: true | |
| type: choice | |
| options: | |
| - Skip | |
| - Staging Only | |
| - Staging + Prod | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ----------------------------------------------------------------- | |
| # BUILD | |
| # ----------------------------------------------------------------- | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| outputs: | |
| pkg_version: ${{ steps.buildvars.outputs.pkg_version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| fetch-tags: false | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24.x | |
| - name: Get Next Version | |
| id: semver | |
| if: ${{ inputs.deploy == 'Staging Only' || inputs.deploy == 'Staging + Prod' }} | |
| uses: ietf-tools/semver-action@v1 | |
| with: | |
| token: ${{ github.token }} | |
| branch: main | |
| skipInvalidTags: true | |
| patchList: fix, bugfix, perf, refactor, test, tests, chore | |
| - name: Get Dev Version | |
| if: ${{ inputs.deploy == 'Skip' }} | |
| id: semverdev | |
| uses: ietf-tools/semver-action@v1 | |
| with: | |
| token: ${{ github.token }} | |
| branch: main | |
| skipInvalidTags: true | |
| noVersionBumpBehavior: 'current' | |
| noNewCommitBehavior: 'current' | |
| - name: Set Release Flag | |
| if: ${{ inputs.deploy == 'Staging Only' || inputs.deploy == 'Staging + Prod' }} | |
| run: | | |
| echo "IS_RELEASE=true" >> $GITHUB_ENV | |
| - name: Set Build Variables | |
| id: buildvars | |
| run: | | |
| if [[ $IS_RELEASE ]]; then | |
| echo "Using AUTO SEMVER mode: ${{ steps.semver.outputs.nextStrict }}" | |
| echo "pkg_version=${{ steps.semver.outputs.nextStrict }}" >> $GITHUB_OUTPUT | |
| echo "::notice::Release ${{ steps.semver.outputs.nextStrict }} created using branch $GITHUB_REF_NAME" | |
| else | |
| echo "Using DEV mode: ${{ steps.semverdev.outputs.nextMajorStrict }}.0.0-dev.$GITHUB_RUN_NUMBER" | |
| echo "pkg_version=${{ steps.semverdev.outputs.nextMajorStrict }}.0.0-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_OUTPUT | |
| echo "::notice::Non-production build ${{ steps.semverdev.outputs.nextMajorStrict }}.0.0-dev.$GITHUB_RUN_NUMBER created using branch $GITHUB_REF_NAME" | |
| fi | |
| - name: Set package.json version | |
| uses: KageKirin/set-node-package-version@d4c41bc3842b559a872b2dae2ced029f68be2abc #v1.0.0 | |
| with: | |
| file: website/package.json | |
| version: ${{ steps.buildvars.outputs.pkg_version }} | |
| - name: NPM Install + Build Site | |
| run: | | |
| npm ci | |
| npm run build | |
| working-directory: ./website | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build Docker Image | |
| uses: docker/build-push-action@v6 | |
| env: | |
| DOCKER_BUILD_SUMMARY: false | |
| with: | |
| context: . | |
| file: Dockerfile | |
| platforms: linux/amd64 | |
| push: true | |
| tags: | | |
| ghcr.io/ietf-tools/queue:${{ steps.buildvars.outputs.pkg_version }} | |
| - name: Create Draft Release | |
| if: ${{ env.IS_RELEASE == 'true' }} | |
| uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0 | |
| with: | |
| prerelease: true | |
| draft: false | |
| owner: ietf-tools | |
| repo: queue | |
| commit: ${{ github.sha }} | |
| tag: ${{ steps.semver.outputs.nextStrict }} | |
| name: ${{ steps.semver.outputs.nextStrict }} | |
| body: '*pending*' | |
| token: ${{ github.token }} | |
| - name: Generate CHANGELOG | |
| id: changelog | |
| uses: Requarks/changelog-action@v1 | |
| if: ${{ env.IS_RELEASE == 'true' }} | |
| with: | |
| token: ${{ github.token }} | |
| fromTag: ${{ steps.semver.outputs.nextStrict }} | |
| toTag: ${{ steps.semver.outputs.current }} | |
| writeToFile: false | |
| - name: Finalize Release | |
| if: ${{ env.IS_RELEASE == 'true' }} | |
| uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0 | |
| with: | |
| allowUpdates: true | |
| makeLatest: true | |
| draft: false | |
| owner: ietf-tools | |
| repo: queue | |
| tag: ${{ steps.semver.outputs.nextStrict }} | |
| name: ${{ steps.semver.outputs.nextStrict }} | |
| body: ${{ steps.changelog.outputs.changes }} | |
| token: ${{ github.token }} | |
| # ----------------------------------------------------------------- | |
| # STAGING | |
| # ----------------------------------------------------------------- | |
| staging: | |
| name: Deploy to Staging | |
| if: ${{ !failure() && !cancelled() && (inputs.deploy == 'Staging Only' || inputs.deploy == 'Staging + Prod') }} | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: staging | |
| env: | |
| PKG_VERSION: ${{needs.build.outputs.pkg_version}} | |
| steps: | |
| - name: Deploy to staging | |
| uses: the-actions-org/workflow-dispatch@v4 | |
| with: | |
| workflow: deploy.yml | |
| repo: ietf-tools/infra-k8s | |
| ref: main | |
| token: ${{ secrets.GH_INFRA_K8S_TOKEN }} | |
| inputs: '{ "environment":"${{ secrets.GHA_K8S_CLUSTER }}", "app":"queue", "appVersion":"${{ env.PKG_VERSION }}", "remoteRef":"${{ github.sha }}" }' | |
| wait-for-completion: true | |
| wait-for-completion-timeout: 10m | |
| wait-for-completion-interval: 30s | |
| display-workflow-run-url: false | |
| # ----------------------------------------------------------------- | |
| # PROD | |
| # ----------------------------------------------------------------- | |
| prod: | |
| name: Deploy to Production | |
| if: ${{ !failure() && !cancelled() && (inputs.deploy == 'Staging + Prod') }} | |
| needs: [build, staging] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production | |
| env: | |
| PKG_VERSION: ${{needs.build.outputs.pkg_version}} | |
| steps: | |
| - name: Deploy to production | |
| uses: the-actions-org/workflow-dispatch@v4 | |
| with: | |
| workflow: deploy.yml | |
| repo: ietf-tools/infra-k8s | |
| ref: main | |
| token: ${{ secrets.GH_INFRA_K8S_TOKEN }} | |
| inputs: '{ "environment":"${{ secrets.GHA_K8S_CLUSTER }}", "app":"queue", "appVersion":"${{ env.PKG_VERSION }}", "remoteRef":"${{ github.sha }}" }' | |
| wait-for-completion: true | |
| wait-for-completion-timeout: 10m | |
| wait-for-completion-interval: 30s | |
| display-workflow-run-url: false |