Merge pull request #555 from algorandfoundation/chore/npm-audit-failure #483
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: Publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release | |
| - decoupling | |
| workflow_dispatch: | |
| concurrency: release | |
| permissions: | |
| contents: write | |
| issues: read | |
| id-token: write | |
| jobs: | |
| ci: | |
| name: Continuous Integration | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Run CI | |
| uses: ./.github/actions/ci | |
| with: | |
| node-version: 22.x | |
| commit-lint-from: ${{ github.event.before }} | |
| commit-lint-to: ${{ github.sha }} | |
| check_docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install docs dependencies | |
| run: npm ci --prefix docs | |
| - name: Verify documentation builds | |
| run: npm run docs:build | |
| build: | |
| name: Build | |
| uses: makerxstudio/shared-config/.github/workflows/node-build-zip.yml@main | |
| needs: | |
| - ci | |
| - check_docs | |
| with: | |
| node-version: 22.x | |
| build-path: dist | |
| artifact-name: package | |
| release: | |
| name: Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Generate bot token | |
| uses: actions/create-github-app-token@v1 | |
| id: app_token | |
| with: | |
| app-id: ${{ secrets.BOT_ID }} | |
| private-key: ${{ secrets.BOT_SK }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| # Fetch entire repository history so we can determine version number from it | |
| fetch-depth: 0 | |
| token: ${{ steps.app_token.outputs.token }} | |
| - name: Set Git user as GitHub actions | |
| run: git config --global user.email "179917785+engineering-ci[bot]@users.noreply.github.com" && git config --global user.name "engineering-ci[bot]" | |
| # semantic-release v25+ needs node 22.14+ | |
| - name: Use Node.js 22.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Download built package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: package | |
| path: artifacts | |
| - name: Unzip package | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| unzip -q "artifacts/package.zip" -d dist | |
| - name: Install dependencies to get semantic release components and plugins | |
| run: npm ci --ignore-scripts | |
| - name: 'Semantic release' | |
| run: npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ steps.app_token.outputs.token }} | |
| publish_docs: | |
| name: Publish Documentation | |
| runs-on: ubuntu-latest | |
| needs: | |
| - ci | |
| - check_docs | |
| if: github.ref == 'refs/heads/decoupling' | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install docs dependencies | |
| run: npm ci --prefix docs | |
| - name: Build documentation | |
| run: npm run docs:build | |
| - name: Publish docs to GitHub Pages | |
| id: deployment | |
| uses: algorandfoundation/algokit-shared-config/.github/actions/publish-docs@main | |
| with: | |
| artifact_path: docs/dist |