From c437b6d3001dbcdde227a5739e39ea708acf2f9d Mon Sep 17 00:00:00 2001 From: Germain Date: Wed, 9 Aug 2023 10:41:27 +0100 Subject: [PATCH] Add NPM release CI workflow (#55) --- .github/workflows/npm_release.yml | 61 +++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/npm_release.yml diff --git a/.github/workflows/npm_release.yml b/.github/workflows/npm_release.yml new file mode 100644 index 00000000..76eaad22 --- /dev/null +++ b/.github/workflows/npm_release.yml @@ -0,0 +1,61 @@ +name: Release npm package +on: + workflow_dispatch: + inputs: + version-bump: + description: The scale of the version bump required for semver compatibility + required: true + default: patch + type: choice + options: + - patch + - minor + - major +concurrency: release +jobs: + release: + name: "Release & Publish" + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./app + steps: + - name: 🧮 Checkout code + uses: actions/checkout@v3 + with: + token: ${{ secrets.ELEMENT_BOT_TOKEN }} + + - name: 🔧 Set up node environment + uses: actions/setup-node@v3 + with: + cache: "yarn" + + - name: 🛠️ Setup + # When running `install` it also calls the `prepare` step which generates + # a build + run: yarn install --pure-lockfile + + - name: 👊 Bump version + run: | + yarn version --no-git-tag-version --${{ github.event.inputs.version-bump }} + git config --global user.name 'ElementRobot' + git config --global user.email 'releases@riot.im' + git commit -am "${{ github.event.inputs.version-bump }} version bump" + git push + - name: 🚀 Publish to npm + id: npm-publish + uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} + access: public + + - name: 🧬 Create release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.npm-publish.outputs.version }} + release_name: Release ${{ steps.npm-publish.outputs.version }} + body: ${{ steps.npm-publish.outputs.version }} Release + draft: false + prerelease: false