Skip to content

Update Version JSON

Update Version JSON #3

Workflow file for this run

name: Update Version JSON
on:
release:
types: [published]
permissions:
contents: write
jobs:
deploy-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate version.json
run: |
TAG_NAME=${{ github.event.release.tag_name }}
VERSION=${TAG_NAME#v}
DOWNLOAD_URL="${{ github.event.release.html_url }}"
mkdir public
echo "{\"version\": \"$VERSION\", \"url\": \"$DOWNLOAD_URL\", \"date\": \"$(date +'%Y-%m-%d')\"}" > public/version.json
cat public/version.json
- name: Deploy to GitHub Pages branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
force_orphan: true
keep_files: false
publish_branch: gh-pages
commit_message: "Auto-update version.json to ${{ github.event.release.tag_name }}"