|
| 1 | +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions |
| 2 | +# TODO: Clean-up |
| 3 | +# See: https://github.com/JulianCataldo/gh-actions |
| 4 | + |
| 5 | +name: 'Release' |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - '([0-9])?(.{+([0-9]),x}).x' |
| 11 | + - 'main' |
| 12 | + - 'next' |
| 13 | + - 'next-major' |
| 14 | + - 'alpha' |
| 15 | + - 'beta' |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: 'read' # for checkout |
| 19 | + |
| 20 | +jobs: |
| 21 | + release: |
| 22 | + name: 'Release' |
| 23 | + runs-on: 'ubuntu-latest' |
| 24 | + permissions: |
| 25 | + contents: 'write' # to be able to publish a GitHub release |
| 26 | + issues: 'write' # to be able to comment on released issues |
| 27 | + pull-requests: 'write' # to be able to comment on released pull requests |
| 28 | + id-token: 'write' # to enable use of OIDC for npm provenance |
| 29 | + |
| 30 | + steps: |
| 31 | + # - name: "Harden Runner" |
| 32 | + # uses: "step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09" # v2.5.1 |
| 33 | + # with: |
| 34 | + # egress-policy: "audit" |
| 35 | + |
| 36 | + - name: 'Git checkout' |
| 37 | + uses: 'actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744' # v3.6.0 |
| 38 | + # run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* |
| 39 | + with: |
| 40 | + fetch-depth: '0' |
| 41 | + |
| 42 | + # - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* |
| 43 | + # persist-credentials: false |
| 44 | + # env: |
| 45 | + # GIT_COMMITTER_NAME: "GitHub Actions Shell" |
| 46 | + # GIT_AUTHOR_NAME: "GitHub Actions Shell" |
| 47 | + # EMAIL: "github-actions[bot]@users.noreply.github.com" |
| 48 | + |
| 49 | + - uses: 'pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598' # v2.4.0 |
| 50 | + with: |
| 51 | + run_install: false |
| 52 | + |
| 53 | + - name: 'Use Node.js 20.6.1' |
| 54 | + uses: 'actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d' # v3.8.1 |
| 55 | + with: |
| 56 | + # registry-url: "https://registry.npmjs.org" |
| 57 | + node-version: '20.6.1' |
| 58 | + cache: 'pnpm' |
| 59 | + |
| 60 | + # @see: npm install -g npm@latest is necessary to make provenance available. More info: https://docs.npmjs.com/generating-provenance-statements |
| 61 | + # - name: "Upgrade npm to latest version" |
| 62 | + # run: "npm install --global npm@9.6.x" |
| 63 | + # env: |
| 64 | + # SKIP_CHECK: "true" |
| 65 | + |
| 66 | + # - name: "Check npm version" |
| 67 | + # run: "npm -v" |
| 68 | + # env: |
| 69 | + # SKIP_CHECK: "true" |
| 70 | + |
| 71 | + - name: 'Install packages' |
| 72 | + run: 'pnpm install --frozen-lockfile' |
| 73 | + |
| 74 | + # - name: "Verify the integrity of provenance attestations and registry signatures for installed dependencies" |
| 75 | + # run: "pnpm audit signatures" |
| 76 | + |
| 77 | + # - name: "npm v8.5+ requires workspaces-update to be set to false" |
| 78 | + # run: "echo 'workspaces-update=false' >> .npmrc" |
| 79 | + |
| 80 | + # - name: "Semantic Release" |
| 81 | + # if: "success()" |
| 82 | + # env: |
| 83 | + # GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 84 | + # NPM_TOKEN: "${{ secrets.NPM_TOKEN }}" |
| 85 | + # GIT_AUTHOR_NAME: "github-actions-shell" |
| 86 | + # GIT_AUTHOR_EMAIL: "github-actions[bot]@users.noreply.github.com" |
| 87 | + # GIT_COMMITTER_NAME: "github-actions-shell" |
| 88 | + # GIT_COMMITTER_EMAIL: "github-actions[bot]@users.noreply.github.com" |
| 89 | + # run: "pnpm exec multi-semantic-release" |
| 90 | + |
| 91 | + - uses: dtinth/setup-github-actions-caching-for-turbo@v1 |
| 92 | + |
| 93 | + - name: 'Build all packages' |
| 94 | + run: 'pnpm build' |
| 95 | + |
| 96 | + - name: 'NPM Identity' |
| 97 | + env: |
| 98 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 99 | + run: | |
| 100 | + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc |
| 101 | +
|
| 102 | + - name: 'Git config' |
| 103 | + run: | |
| 104 | + git config --global user.name "${{ github.actor }}" |
| 105 | + git config --global user.email "${{ github.actor }}@users.noreply.github.com" |
| 106 | +
|
| 107 | + # - name: 'Lerna version' |
| 108 | + # run: | |
| 109 | + # pnpm lerna version --conventional-commits --yes |
| 110 | + |
| 111 | + - name: 'Lerna publish [main]' |
| 112 | + if: github.ref == 'refs/heads/main' |
| 113 | + # --create-release=github not working |
| 114 | + env: |
| 115 | + GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}' |
| 116 | + NPM_TOKEN: '${{ secrets.NPM_TOKEN }}' # Not really needed (already global) |
| 117 | + run: | |
| 118 | + pnpm lerna publish --conventional-commits --exact --conventional-graduate --create-release=github --yes |
| 119 | +
|
| 120 | + - name: 'Lerna publish [next]' |
| 121 | + if: github.ref == 'refs/heads/next' |
| 122 | + env: |
| 123 | + NPM_TOKEN: '${{ secrets.NPM_TOKEN }}' # Not really needed (already global) |
| 124 | + run: | |
| 125 | + pnpm lerna publish --conventional-commits --exact --conventional-prerelease --canary --dist-tag=next --preid=next --yes |
| 126 | +
|
| 127 | + # pnpm publish -r |
| 128 | + |
| 129 | + # - name: "Publish" |
| 130 | + # run: "pnpm publish -r" |
| 131 | + |
| 132 | +# --changelog-preset conventionalcommits |
0 commit comments