From d189768167226ae2822855445aa6a425e5db336d Mon Sep 17 00:00:00 2001 From: satoren Date: Sat, 12 Apr 2025 13:57:22 +0900 Subject: [PATCH] release flow --- .github/workflows/release.yml | 49 ++++++++++++++++++++++++++--------- node/package.json | 2 +- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ae9fda..e4e45b7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,9 @@ name: Release on: push: - branches: - - main + tags: + - 'v*.*.*' + jobs: build_wasm: name: build for node.js @@ -20,20 +21,19 @@ jobs: with: name: node_lua_with_lrdb path: node/bin/node_lua_with_lrdb.* - release: + + publish: needs: build_wasm - name: Release + name: Publish to NPM runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - persist-credentials: false - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 + registry-url: 'https://registry.npmjs.org' - name: Download a node_lua_with_lrdb uses: actions/download-artifact@v4 with: @@ -43,9 +43,34 @@ jobs: working-directory: node - run: npm run bundle working-directory: node - - name: Release - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npx semantic-release + - name: Get version from tag + id: get_version + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + - name: Update package version + run: npm version ${{ steps.get_version.outputs.VERSION }} --no-git-tag-version + working-directory: node + - name: Publish to NPM + run: npm publish working-directory: node + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + create_release: + needs: publish + name: Create GitHub Release + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: node_lua_with_lrdb + path: artifacts/ + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: artifacts/* + generate_release_notes: true diff --git a/node/package.json b/node/package.json index 1ddfc5e..359a072 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "lrdb-debuggable-lua", - "version": "0.6.0", + "version": "0.6.0-dev", "main": "dist/index", "license": "MIT", "scripts": {