Skip to content

Commit

Permalink
feat: refactor release pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: seven <zilisheng1996@gmail.com>
  • Loading branch information
Blankll committed Jan 24, 2024
1 parent 908f4a5 commit c775925
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
30 changes: 27 additions & 3 deletions .github/workflows/page-site.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: generate page site
on:
release:
types: [created]
push:
branches: [master]
pull_request:
branches: [master]

jobs:
publish:
Expand All @@ -15,8 +17,31 @@ jobs:
uses: actions/checkout@v4
- run: npm ci
- run: npm run docs:build
- name: Compare Versions
run: |
TAG_VERSION=$(echo ${{env.TAG}} | tr -dc '0-9')
PACKAGE_VERSION=$(echo ${{env.PACKAGE}} | tr -dc '0-9')
if (( $((10#$PACKAGE_VERSION + 1)) > $((10#$TAG_VERSION + 1)) )); then
echo "new version ready to release"
echo "RELEASE=true" >> "$GITHUB_ENV"
else
echo "no new version to release"
echo "RELEASE=false" >> "$GITHUB_ENV"
fi
- uses: neverendingqs/gh-action-tag-on-npm-version@master
if: env.RELEASE == 'true' && github.ref == 'refs/heads/master'
- name: Build Release
uses: "marvinpinto/action-automatic-releases@latest"
if: env.RELEASE == 'true' && github.ref == 'refs/heads/master'
with:
prerelease: false
repo_token: "${{ secrets.GITHUB_TOKEN }}"
files: |
dist/**/*
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
if: env.RELEASE == 'true' && github.ref == 'refs/heads/master'
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
Expand All @@ -26,4 +51,3 @@ jobs:
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: main
environment: production

6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dockit-site",
"version": "0.0.4",
"version": "0.0.7",
"description": "",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit c775925

Please sign in to comment.