|
1 | 1 | name: Publish package to npmjs
|
2 | 2 |
|
3 |
| -# This workflow runs when code is pushed to `main` (i.e: when a pull request is merged) |
4 | 3 | on:
|
5 |
| - push: |
6 |
| - branches: [main] |
| 4 | + push: |
| 5 | + branches: [main] |
7 | 6 |
|
8 |
| -# Ensure that only once instance of this workflow executes at a time. |
| 7 | +# Ensure that only one instance of this workflow executes at a time. |
9 | 8 | # If multiple PRs are merged in quick succession, there will only ever be one publish workflow running and one pending.
|
10 | 9 | concurrency: ${{ github.workflow }}
|
11 | 10 |
|
12 | 11 | jobs:
|
13 |
| - version: |
14 |
| - runs-on: ubuntu-latest |
15 |
| - |
16 |
| - # OSBotify will update the version on `main`, so this check is important to prevent an infinite loop |
17 |
| - if: ${{ github.actor != 'OSBotify' }} |
18 |
| - |
19 |
| - steps: |
20 |
| - - uses: actions/checkout@v4 |
21 |
| - with: |
22 |
| - ref: main |
23 |
| - # The OS_BOTIFY_COMMIT_TOKEN is a personal access token tied to osbotify |
24 |
| - # This is a workaround to allow pushes to a protected branch |
25 |
| - token: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }} |
26 |
| - |
27 |
| - - name: Decrypt & Import OSBotify GPG key |
28 |
| - run: | |
29 |
| - cd .github |
30 |
| - gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output OSBotify-private-key.asc OSBotify-private-key.asc.gpg |
31 |
| - gpg --import OSBotify-private-key.asc |
32 |
| - env: |
33 |
| - LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} |
34 |
| - |
35 |
| - - name: Set up git for OSBotify |
36 |
| - run: | |
37 |
| - git config --global user.signingkey AEE1036472A782AB |
38 |
| - git config --global commit.gpgsign true |
39 |
| - git config --global user.name OSBotify |
40 |
| - git config --global user.email infra+osbotify@expensify.com |
41 |
| -
|
42 |
| - - uses: actions/setup-node@v4 |
43 |
| - with: |
44 |
| - node-version-file: '.nvmrc' |
45 |
| - registry-url: 'https://registry.npmjs.org' |
46 |
| - |
47 |
| - - name: Install yarn packages |
48 |
| - run: yarn install --immutable |
49 |
| - |
50 |
| - - name: Update npm version |
51 |
| - run: yarn version patch |
52 |
| - |
53 |
| - - name: Set new version in GitHub ENV |
54 |
| - run: echo "NEW_VERSION=$(jq '.version' package.json)" >> $GITHUB_ENV |
55 |
| - |
56 |
| - - name: Commit version bump |
57 |
| - run: git commit -am "Bump version to ${{ env.NEW_VERSION }}" |
58 |
| - |
59 |
| - - name: Tag version bump |
60 |
| - run: git tag ${{ env.NEW_VERSION }} |
61 |
| - |
62 |
| - - name: Push branch and publish tags |
63 |
| - run: git push --set-upstream origin main && git push --tags |
64 |
| - |
65 |
| - - name: Build package |
66 |
| - run: yarn pack |
67 |
| - |
68 |
| - - name: Publish to npm |
69 |
| - run: npm publish --access public |
70 |
| - env: |
71 |
| - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 12 | + publish: |
| 13 | + # os-botify[bot] will update the version on `main`, so this check is important to prevent an infinite loop |
| 14 | + if: ${{ github.actor != 'os-botify[bot]' }} |
| 15 | + uses: Expensify/GitHub-Actions/.github/workflows/npmPublish.yml@main |
| 16 | + secrets: inherit |
| 17 | + with: |
| 18 | + should_run_pack: true |
0 commit comments