From 4ae7ad50209c6da57c0745f891956d1ce3475e6a Mon Sep 17 00:00:00 2001 From: root Date: Wed, 16 Aug 2023 08:00:16 +0000 Subject: [PATCH] Release workflow inited. --- .github/workflows/release.yml | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b585ab5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: release + +on: + pull_request: + paths-ignore: + - 'docs/**' + - '.clang-format' + - '.gitignore' + - 'README.md' + workflow_dispatch: + inputs: + release_type: + type: choice + description: Release type + options: + - major + - minor + - patch + default: patch + +jobs: + release: + runs-on: [ ubuntu-22.04 ] + environment: prod + + steps: + - name: Check out branch + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + + - name: Setup Node.js environment + uses: actions/setup-node@v3.6.0 + + - name: Set git user + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'bot@nil.foundation' + + - name: Update version in package.json + run: | + npm version patch -m "${{ inputs.release_type }} release %s" + git status + + - name: Push changes + uses: ad-m/github-push-action@master + with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.event.pull_request.head.ref }} + tags: true + + - name: Install dependencies and build 🔧 + run: npm ci && npm run build + - name: Publish package on NPM + run: npm publish