Skip to content

Commit

Permalink
ci: add release action
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobLinCool committed Jan 23, 2023
1 parent 8135935 commit e28c82d
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release

on:
push:
tags:
- "v*"
workflow_dispatch:

jobs:
release-npm:
name: Release to NPM (${{ github.ref }})
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check if Tag on Main
run: |
git checkout main
branch=$(git branch main --contains ${{ github.ref }})
git checkout ${{ github.ref }}
if [ -z $branch ]; then
echo "Tag ${{ github.ref }} is not contained in the main branch."
exit 1
fi
- name: Setup PNPM
uses: pnpm/action-setup@v2.2.4
with:
version: latest
run_install: true

- name: Test
run: pnpm test

- name: Publish
run: |
pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
pnpm publish --verbose --access public --no-git-checks
release-note:
name: Release Note (${{ github.ref }})
runs-on: ubuntu-latest
needs:
- release-npm
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Publish Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GH_TOKEN }}"
prerelease: false
files: |
README.md
LICENSE

0 comments on commit e28c82d

Please sign in to comment.