chore: Update GitHub action to automatically release new version

This commit is contained in:
Peng-YM 2022-07-13 14:41:08 +08:00
parent 9677c7ebbd
commit 9fba3506f0

View File

@ -21,16 +21,30 @@ jobs:
with: with:
node-version: "14" node-version: "14"
- name: Install dependencies - name: Install dependencies
run: npm install -g pnpm && cd backend && pnpm i
- name: Test
run: cd backend && pnpm test
- name: Build
run: cd backend && pnpm run build
- name: Commit changes
if: contains(github.event.head_commit.message, '#build')
run: | run: |
git config user.email github-actions npm install -g pnpm
git config user.name github-actions@github.com cd backend && pnpm i
git add . - name: Test
git commit -m "Release" -a run: |
git push cd backend
pnpm test
- name: Build
run: |
cd backend
pnpm run build
- id: tag
name: Generate release tag
run: |
cd backend
SUBSTORE_RELEASE=`node --eval="process.stdout.write(require('./package.json').version)"`
echo "::set-output name=release_tag::$SUBSTORE_RELEASE"
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
files: |
./backend/sub-store.min.js
./backend/dist/cron-sync-artifacts.min.js
./backend/dist/sub-store-parser.loon.min.js