From ccbe0897a6ba21fdaf772c8e3f9ca153d02e3324 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Oct 2024 15:56:08 -0600 Subject: [PATCH] Use the shared npm publish workflow to deploy See https://github.com/Expensify/Expensify/issues/432173 --- .github/OSBotify-private-key.asc.gpg | Bin 3940 -> 0 bytes .github/workflows/publish.yml | 89 +++------------------------ .gitignore | 3 - 3 files changed, 10 insertions(+), 82 deletions(-) delete mode 100644 .github/OSBotify-private-key.asc.gpg diff --git a/.github/OSBotify-private-key.asc.gpg b/.github/OSBotify-private-key.asc.gpg deleted file mode 100644 index 03f06222d0fe956cdb4d3cc00df9b2ff3566da21..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3940 zcmV-q51a6e4Fm}T0wnTvM*#)?4ffLO0iQFMt9JY89BP@dCk-creW&cdTFluB9b0WJ z`5Jxzm-8iHfDXd^NMZn%XQEG~HsZ|Z;ISa8KCll~NZ(rmGeQixzP#G^bL%h4 zEf)F@!Cm6&69|TE&bT@2*g0eLG49}RV)=eRBQ#UCQM&IqjOWfgIJ%(!`quL`JX#H1 z#x#56zHFP|551^rEhB&c)y@=-xSGUgTg`IQ@W+*kBt}5jPn`?#^83_6NZvM zdtsv2vj!9TD(SJP;6I>-nsLeg*nVX&`$w`$|Zgphf>F&nNycOHHU1QVnki1V4#UpE6q!H z4)6#qzw6FXv!%py6X8*9JJtwwyg{O5i?`nCQS`y&orz;SYrZ62Ay=&m_rLJ8rz%M@`wjrns3awz_RwAINPTIag2!#Qg+9lW>{{RjL zeIu9=L+XM?P*)8^BQ8PkuF<~T`o8=b7;Mf~P$JpO^}ulO|C?NkPj4x*rhJp*V}){R zSq#}3B(=OBw&arj#vku&tTIaDo+QlK`s5)uDd5(kRzxjr5(Hp^2_Sr&rpv`-s$8pT zc^MHBx7JGGQR=jH!)lKiTUen6YJzK-$;V%E&S?}~+3Pf}jPvcJ+Q)B>!} z|3Q+7&b?oi!yN4Yuf?r4Bhf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-=FuW(anF z#s02EUTBm$elyuI5mo;veTPT$D&mSD;=^VIa1@P8td(<@dcB!Xef#oi-o$hk-nH-B z`ydt`X4>PCwj0d=%-*3ov40m_QO|xzUY;AJ4*yaJ;oOwCSGoN@6SIDB9Kox*$smAo z8k)%6M~y4pdU(b~6YaXo?xO>Z-zu;AJvH(y;sp{(d; z&P8rYkcL)mG}{FOJ~jmt?gBC;L1AHCbR?*FV*%54G+JVNLv=f9YY#D;0wG3vy5LPu z5!A;<<_$_Y^9#dH8TQjK+4OhL*=hbXI0-m_oF>{;k!Y_IAq2Sq zR6D(swr%6EG#bss!%YOYPxXge*hu9Do&_&bVn)?v^IBO7JX0u1TlkZ^$qr5+L&n1r zT5KP`QQ@t9cT+XhQ=+;GT0CAe&G{KnhLaYt%j7W(w}XnOvkSOee!c zh2{jxRAkwOv!P%@d!6A-AS$%Y)SgGr+i&eyKrs#+yQUFo${e$Gppy1H;*B^9A1xY) y%Z>H(8pCC4E%S6Ea96*e2}NkXPW>OI4tj1Ml9%4&k}@?~qT7!YP<26FZs%5&_MqPY diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 38239be..11cd6c1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,87 +1,18 @@ name: Publish package to npmjs -# This workflow runs when code is pushed to `main` (i.e: when a pull request is merged) on: - push: - branches: [main] + push: + branches: [main] -# Ensure that only once instance of this workflow executes at a time. +# Ensure that only one instance of this workflow executes at a time. # If multiple PRs are merged in quick succession, there will only ever be one publish workflow running and one pending. concurrency: ${{ github.workflow }} jobs: - version: - runs-on: ubuntu-latest - - # OSBotify will update the version on `main`, so this check is important to prevent an infinite loop - if: ${{ github.actor != 'OSBotify' }} - - steps: - - uses: actions/checkout@v3 - with: - ref: main - - - name: Decrypt & Import OSBotify GPG key - run: | - cd .github - gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output OSBotify-private-key.asc OSBotify-private-key.asc.gpg - gpg --import OSBotify-private-key.asc - env: - LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} - - - name: Set up git for OSBotify - run: | - git config --global user.signingkey AEE1036472A782AB - git config --global commit.gpgsign true - git config --global user.name OSBotify - git config --global user.email infra+osbotify@expensify.com - - - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - registry-url: 'https://registry.npmjs.org' - - - name: Generate branch name - run: echo "BRANCH_NAME=OSBotify-bump-version-$(uuidgen)" >> $GITHUB_ENV - - - name: Create branch for version-bump pull request - run: git checkout -b ${{ env.BRANCH_NAME }} - - - name: Install npm packages - run: npm ci - - - name: Update npm version - run: npm version patch - - - name: Set new version in GitHub ENV - run: echo "NEW_VERSION=$(jq '.version' package.json)" >> $GITHUB_ENV - - - name: Push branch and publish tags - run: git push --set-upstream origin ${{ env.BRANCH_NAME }} && git push --tags - - - name: Create pull request - run: | - gh pr create \ - --title "Update version to ${{ env.NEW_VERSION }}" \ - --body "Update version to ${{ env.NEW_VERSION }}" - sleep 5 - env: - GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - - - name: Auto-approve pull request - run: gh pr review --approve ${{ env.BRANCH_NAME }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Auto-merge pull request - run: gh pr merge --merge --delete-branch ${{ env.BRANCH_NAME }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Build package - run: npm run build - - - name: Publish to npm - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + publish: + # os-botify[bot] will update the version on `main`, so this check is important to prevent an infinite loop + if: ${{ github.actor != 'os-botify[bot]' }} + uses: Expensify/GitHub-Actions/.github/workflows/npmPublish.yml@main + secrets: inherit + with: + should_run_build: true diff --git a/.gitignore b/.gitignore index 9990850..6f2b995 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,3 @@ dist/ # NPM file created by GitHub actions .npmrc - -# Decrypted private key we do not want to commit -.github/OSBotify-private-key.asc