-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5a8872
commit e3acc2b
Showing
2 changed files
with
81 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Publish Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
cache: npm | ||
- name: Restore node_modules cache | ||
uses: actions/cache/restore@v3 | ||
id: cache | ||
with: | ||
path: node_modules | ||
key: timestamp${{ hashFiles('package-lock.json') }} | ||
- name: Install dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: npm ci | ||
- name: Cache node modules | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: node_modules | ||
key: timestamp${{ hashFiles('package-lock.json') }} | ||
build: | ||
needs: prepare | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
cache: npm | ||
- name: Unpack node_modules | ||
uses: actions/cache/restore@v3 | ||
id: cache | ||
with: | ||
path: node_modules | ||
key: timestamp${{ hashFiles('package-lock.json') }} | ||
- name: Build | ||
run: npm run build | ||
publish: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
registry-url: "https://registry.npmjs.org" | ||
- name: Unpack node_modules | ||
uses: actions/cache/restore@v3 | ||
id: cache | ||
with: | ||
path: node_modules | ||
key: timestamp${{ hashFiles('package-lock.json') }} | ||
- name: Update version | ||
run: | | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
VERSION=${GITHUB_REF#refs/tags/v} | ||
npm version $VERSION --no-git-tag-version --allow-same-version | ||
git add package.json | ||
git commit -m "chore(release): ${VERSION} [skip ci]" | ||
git push | ||
- name: Build and publish | ||
run: | | ||
npm run build | ||
npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |