Skip to content

Commit

Permalink
ci: add auto publish
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Jun 2, 2023
1 parent 9b60e15 commit d0a533d
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflow/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Automatic Publish
on:
push:
branches:
- master
tags-ignore:
- '**'
paths-ignore:
- '**/*.md'
- LICENSE
- '**/*.gitignore'
- .editorconfig
- docs/**
pull_request: null
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
check-latest: true
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm install -g npm && npm install
- name: Publish
run: |
if git log -1 --pretty=%B | grep "^release: [0-9]\+\.[0-9]\+\.[0-9]\+$";
then
npm publish --provenance --access public
elif git log -1 --pretty=%B | grep "^release: [0-9]\+\.[0-9]\+\.[0-9]\+";
then
npm publish --tag next --provenance --access public
else
echo "Not a release, skipping publish"
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit d0a533d

Please sign in to comment.