|
12 | 12 | # |
13 | 13 |
|
14 | 14 | # 🚨 GITHUB SECRETS REQUIRED: |
| 15 | +# - NPM_TOKEN: A NPM Access Token with Publish access. |
15 | 16 | # - GH_TOKEN: A GitHub token with write repo access. |
16 | | -# You can generate one from here: https://docs.github.com/en/[email protected]/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens |
| 17 | +# You can generate one from here: https://github.com/settings/tokens |
17 | 18 | # make sure to add it to the repo secrets with the name GH_TOKEN |
| 19 | +# Attention: Not to be confused with the GITHUB_TOKEN, this is a different token with different permissions. |
18 | 20 |
|
19 | | -name: New CLI Version |
| 21 | +name: Deploy CLI to NPM Registry |
20 | 22 |
|
21 | 23 | on: |
22 | 24 | workflow_dispatch: |
|
32 | 34 | - major |
33 | 35 |
|
34 | 36 | jobs: |
35 | | - release: |
36 | | - name: Create New Version and push new tag |
| 37 | + deploy: |
37 | 38 | runs-on: ubuntu-latest |
| 39 | + environment: |
| 40 | + name: CLI |
38 | 41 | permissions: |
39 | 42 | contents: write |
40 | 43 | steps: |
41 | 44 | - name: 🔍 GH_TOKEN |
42 | 45 | if: env.GH_TOKEN == '' |
43 | 46 | env: |
44 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
45 | | - run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV |
46 | | - |
| 47 | + GH_TOKEN: ${{ secrets.GH_TOKEN }} |
| 48 | + run: echo "GH_TOKEN=${GH_TOKEN}" >> $GITHUB_ENV |
47 | 49 | - name: 📦 Checkout project repo |
48 | 50 | uses: actions/checkout@v3 |
49 | 51 | with: |
50 | 52 | fetch-depth: 0 |
51 | 53 | token: ${{ secrets.GH_TOKEN }} |
52 | | - |
53 | 54 | - name: 📝 Git User Setup |
54 | 55 | run: | |
55 | 56 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" |
56 | 57 | git config --global user.name "github-actions[bot]" |
57 | | -
|
58 | 58 | - name: 📦 Setup Node + PNPM |
59 | 59 | uses: ./.github/actions/setup-node-pnpm-install |
60 | | - |
61 | | - - name: Install CLI dependencies |
| 60 | + - name: 📦 Install CLI Dependencies |
62 | 61 | run: | |
63 | 62 | cd cli |
64 | 63 | pnpm install --frozen-lockfile |
65 | | -
|
66 | | - - name: Bump release version |
| 64 | + - name: 📦 Bump release version |
67 | 65 | run: | |
68 | 66 | cd cli |
69 | 67 | echo "NEW_VERSION=$(npm --no-git-tag-version version $RELEASE_TYPE)" >> $GITHUB_ENV |
70 | 68 | echo "RELEASE_TAG=latest" >> $GITHUB_ENV |
71 | 69 | env: |
72 | 70 | RELEASE_TYPE: ${{ github.event.inputs.release-type }} |
73 | | - |
74 | 71 | - name: Commit package.json changes |
75 | 72 | run: | |
76 | 73 | git add "cli/package.json" |
77 | | - git commit -m "build(cli): release ${{ env.NEW_VERSION }}" |
78 | | -
|
79 | | - - name: Set publishing config |
80 | | - run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}" |
| 74 | + git commit -m "build(cli): release CLI ${{ env.NEW_VERSION }}" |
| 75 | + - name: 🔑 Set publishing config |
| 76 | + run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" |
81 | 77 | env: |
82 | | - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
83 | | - |
84 | | - - name: Publish |
| 78 | + NPM_TOKEN: ${{secrets.NPM_TOKEN}} |
| 79 | + - name: 📦 Publish to NPM registry |
85 | 80 | run: | |
86 | 81 | cd cli |
87 | 82 | pnpm publish --verbose --tag ${{ env.RELEASE_TAG }} |
88 | | -
|
89 | | - - name: Push changes to repository |
90 | | - env: |
91 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + - name: 🔗 Push changes to repository |
92 | 84 | run: | |
93 | 85 | git push origin && git push --tags |
0 commit comments