Skip to content

Update module.json

Update module.json #16

Workflow file for this run

name: Check and Release
on:
push:
branches:
- main
jobs:
check_version_and_release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "14"
- name: Install dependencies
run: npm install
- name: Check module.json version
id: check_version
run: |
# Get the current version from module.json
CURRENT_VERSION=$(jq -r .version module.json)
# Get the latest release version
LATEST_VERSION=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
echo "Current version: $CURRENT_VERSION"
echo "Latest version: $LATEST_VERSION"
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then
echo "Version has been updated."
echo "::set-output name=updated::true"
echo "::set-output name=new_version::$CURRENT_VERSION"
else
echo "No version update."
echo "::set-output name=updated::false"
fi
- name: Create zip if updated
if: steps.check_version.outputs.updated == 'true'
run: |
zip module.zip module.json zh-tw.json README.md
- name: Upload release assets
if: steps.check_version.outputs.updated == 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.check_version.outputs.new_version }}
# module.zip: 安裝用(含 zh-tw.json、README);module.json: 單獨上傳供 manifest URL 使用
# 例如 https://github.com/hktrpg/foundry_zh-tw/releases/download/1.14.360/module.json
files: |
module.zip
module.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}