add release action
This commit is contained in:
parent
0d36b08f96
commit
14d30b1895
28
.github/workflows/auto-tag.yml
vendored
Normal file
28
.github/workflows/auto-tag.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: Auto Tag on Release PR Merge
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tag:
|
||||||
|
if: >
|
||||||
|
github.event.pull_request.merged == true &&
|
||||||
|
startsWith(github.event.pull_request.title, 'Release v')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Extract version from PR title
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
VERSION=$(echo "${{ github.event.pull_request.title }}" | sed 's/^Release //')
|
||||||
|
echo "tag=$VERSION" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Create and push tag
|
||||||
|
run: |
|
||||||
|
git tag "${{ steps.version.outputs.tag }}"
|
||||||
|
git push origin "${{ steps.version.outputs.tag }}"
|
||||||
12
.github/workflows/publish.yml
vendored
12
.github/workflows/publish.yml
vendored
@ -19,6 +19,16 @@ jobs:
|
|||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npm test
|
- run: npm test
|
||||||
- run: npm publish
|
- name: Determine npm tag
|
||||||
|
id: npm-tag
|
||||||
|
run: |
|
||||||
|
VERSION="${GITHUB_REF#refs/tags/v}"
|
||||||
|
if echo "$VERSION" | grep -qE '(alpha|beta|rc|next)'; then
|
||||||
|
echo "tag=next" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "tag=latest" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- run: npm publish --tag ${{ steps.npm-tag.outputs.tag }}
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user