From 2f5cf525ecc382a6df8c29471ab30c388b6574a0 Mon Sep 17 00:00:00 2001 From: corb3nik Date: Fri, 6 Sep 2024 16:44:35 -0400 Subject: [PATCH] Add release workflow --- .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..fae0f65 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: 🚀 Release + +on: + workflow_dispatch: + +env: + NODE_VERSION: 20 + PNPM_VERSION: 9 + +jobs: + release: + name: Release + runs-on: ubuntu-latest + + steps: + - name: Checkout project + uses: actions/checkout@v4 + + - name: Check version + id: meta + run: | + VERSION=$(jq -r .version manifest.json) + echo "version=${VERSION}" >> $GITHUB_OUTPUT + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ env.PNPM_VERSION }} + run_install: true + + - name: Build package + run: pnpm build + + - name: Sign package + working-directory: dist + run: | + if [[ -z "${{ secrets.PRIVATE_KEY }}" ]]; then + echo "Set an ed25519 key as PRIVATE_KEY in GitHub Action secret to sign." + else + echo "${{ secrets.PRIVATE_KEY }}" > private_key.pem + openssl pkeyutl -sign -inkey private_key.pem -out plugin_package.zip.sig -rawin -in plugin_package.zip + rm private_key.pem + fi + + - name: Create release + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.meta.outputs.version }} + commit: ${{ github.sha }} + body: 'Release ${{ steps.meta.outputs.version }}' + artifacts: 'dist/plugin_package.zip,dist/plugin_package.zip.sig'