Skip to content

feat: refactor release pipeline #9

feat: refactor release pipeline

feat: refactor release pipeline #9

Workflow file for this run

name: generate page site
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
name: Publish to Cloudflare Pages
steps:
- name: Checkout
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 }}
projectName: dockit-site
directory: dist
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: main
environment: production