Skip to content

Commit

Permalink
Auto generate github release on version change (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Dec 23, 2024
1 parent 063c1d7 commit c8796f8
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 28 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/publish.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Create a release

on:
pull_request:
types: [closed]
branches:
- main
- master
paths:
- "package.json"

jobs:
create-release:
runs-on: ubuntu-latest
if: >
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'Release')
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Get current version
id: current_version
run: echo ::set-output name=version::$(node -p "require('./package.json').version")
- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.current_version.outputs.version }}
draft: false
prerelease: false
generate_release_notes: true
make_latest: "true"
publish:
runs-on: ubuntu-latest
if: >
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'Release')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: lts/*
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit c8796f8

Please sign in to comment.