Skip to content

Commit 91344d3

Browse files
committed
feat: update the gh action
1 parent 8ed7cba commit 91344d3

File tree

1 file changed

+47
-17
lines changed

1 file changed

+47
-17
lines changed

.github/workflows/publish.yml

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,58 @@
1-
name: Publish CI
1+
name: Create Release
22

33
on:
4-
push:
5-
branches: [master]
4+
workflow_dispatch:
5+
inputs:
6+
prerelease:
7+
type: boolean
8+
description: Mark as pre-release?
69

710
jobs:
8-
publish:
11+
create-release:
912
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
packages: write
1016
steps:
1117
- uses: actions/checkout@v3
1218
- uses: actions/setup-node@v3
1319
with:
14-
node-version: "18.x"
15-
registry-url: "https://npm.pkg.github.com"
16-
scope: "@euler-xyz"
17-
- run: npm ci
18-
- run: npm run build --if-present
19-
- run: |
20-
git config user.name github-actions
21-
git config user.email github-actions@github.com
22-
npm version patch
23-
git push
24-
git push --tags
25-
- run: npm publish --registry=https://npm.pkg.github.com/ --access restricted
20+
node-version: 18
21+
registry-url: https://npm.pkg.github.com/
22+
23+
- name: Conventional Changelog Action
24+
id: changelog
25+
uses: TriPSs/conventional-changelog-action@v3
26+
with:
27+
release-count: 50
28+
github-token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Create Release
31+
uses: actions/create-release@v1
32+
if: ${{ steps.changelog.outputs.skipped == 'false' }}
2633
env:
27-
# NOTE: using the built-in GITHUB token here because we're publishing to THIS repository's packages.
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
prerelease: ${{ github.event.inputs.prerelease }}
37+
tag_name: ${{ steps.changelog.outputs.tag }}
38+
release_name: ${{ steps.changelog.outputs.tag }}
39+
body: ${{ steps.changelog.outputs.clean_changelog }}
40+
41+
- name: Install dependencies
42+
if: ${{ steps.changelog.outputs.skipped == 'false' }}
43+
run: yarn
44+
env:
45+
# This is needed because we need to install the linting packages
2846
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
48+
# - name: Authenticate with the GitHub Package Registry
49+
# if: ${{ steps.changelog.outputs.skipped == 'false' }}
50+
# run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >>
51+
# ~/.npmrc
52+
53+
- name: Github publish package
54+
if: ${{ steps.changelog.outputs.skipped == 'false' }}
55+
uses: JS-DevTools/npm-publish@v3
56+
with:
57+
token: ${{ secrets.GITHUB_TOKEN }}
58+
registry: "https://npm.pkg.github.com"

0 commit comments

Comments
 (0)