From bf2d788e2db979e694f38ca8468c4dfd48bed3df Mon Sep 17 00:00:00 2001 From: Antoine Bouhours Date: Tue, 5 Nov 2024 12:31:54 +0100 Subject: [PATCH] Create release1.yaml --- .github/workflows/release1.yaml | 61 +++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/release1.yaml diff --git a/.github/workflows/release1.yaml b/.github/workflows/release1.yaml new file mode 100644 index 0000000..0a60155 --- /dev/null +++ b/.github/workflows/release1.yaml @@ -0,0 +1,61 @@ +name: Release + +on: + workflow_dispatch: + inputs: + versionType: + description: version type increment (major | minor | patch) + required: true + type: choice + options: + - major + - minor + - patch + nodeAuthToken: + description: NPM access token + required: true + type: string +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Mask Node Auth Token + - run: | + NODE_AUTH_TOKEN=$(jq -r '.inputs.nodeAuthToken' $GITHUB_EVENT_PATH) + echo ::add-mask::$NODE_AUTH_TOKEN + echo NODE_AUTH_TOKEN=$NODE_AUTH_TOKEN >> $GITHUB_ENV + + - uses: actions/create-github-app-token@v1 + id: app-token + name: Generate app token + with: + app-id: ${{ vars.POWSYBL_ACTIONS_APPID }} + private-key: ${{ secrets.POWSYBL_ACTIONS_SECRET }} + + - name: Checkout sources + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + + - uses: actions/setup-node@v4 + with: + node-version: '18.x' + registry-url: 'https://registry.npmjs.org' + + - name: Add release commit and publish + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + npm version ${{ github.event.inputs.versionType }} + git push origin main + git push origin $(git tag --points-at HEAD) + npm install + npm publish + env: + NODE_AUTH_TOKEN: ${{ env.NODE_AUTH_TOKEN }} + + - name: Create GitHub release + run: | + gh release create $(git tag --points-at HEAD) --generate-notes + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}