From 8f15bb28c4ce4203c91b1f95b3d250d47e3dd575 Mon Sep 17 00:00:00 2001 From: Lukas Streckeisen Date: Thu, 8 May 2025 15:43:53 +0200 Subject: [PATCH] move npm release to own workflow, automate github release creation --- .github/workflows/build.yml | 10 ---------- .github/workflows/release.yml | 37 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9e51e43..752e482 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,8 +4,6 @@ on: push: branches: - main - release: - types: [published] permissions: contents: read @@ -73,11 +71,3 @@ jobs: with: name: cml-language-server path: ./cml-ls/ - - - name: Prepare publication - if: github.event_name == 'release' # Publish only on release creation - run: sed -i -e 's//${{ secrets.GITHUB_TOKEN }}/g' .yarnrc.yml - - - name: Publish to GitHub Package Registry - if: github.event_name == 'release' # Publish only on release creation - run: yarn npm publish --access public diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..affe5f2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Release Workflow + +on: + push: + tags: + - 'v*' + +jobs: + release-build: + uses: ./.github/workflows/build.yml + secrets: inherit + + release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit + fetch-depth: 0 # a full history is required for pull request analysis + - name: Download language-server artifact + uses: actions/download-artifact@v4 + with: + name: cml-language-server + path: ./cml-ls + + - name: Prepare publication + run: sed -i -e 's//${{ secrets.GITHUB_TOKEN }}/g' .yarnrc.yml + + - name: Publish to GitHub Package Registry + run: yarn npm publish --access public + + - name: Create GitHub release + id: create_release + uses: softprops/action-gh-release@v2 + with: + files: ./cml-ls \ No newline at end of file