This commit is contained in:
@@ -7,72 +7,65 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- run: echo "💡 The ${{ gitea.repository }} repository will be cloned to the runner."
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
- uses: RouxAntoine/checkout@v3.5.4
|
||||
|
||||
# Extrait la version depuis le tag (ex: v1.2.3 → 1.2.3)
|
||||
- name: Extract tag version number
|
||||
id: get_version
|
||||
uses: battila7/get-version-action@v2
|
||||
|
||||
# Met à jour version, manifest et download dans system.json
|
||||
- name: Substitute Manifest and Download Links For Versioned Ones
|
||||
id: sub_manifest_link_version
|
||||
uses: microsoft/variable-substitution@v1
|
||||
with:
|
||||
node-version: "20"
|
||||
files: "system.json"
|
||||
env:
|
||||
version: ${{steps.get_version.outputs.version-without-v}}
|
||||
url: https://www.uberwald.me/gitea/${{gitea.repository}}
|
||||
manifest: https://www.uberwald.me/gitea/${{gitea.repository}}/releases/download/latest/system.json
|
||||
download: https://www.uberwald.me/gitea/${{gitea.repository}}/releases/download/${{github.event.release.tag_name}}/fvtt-prism-rpg-${{github.event.release.tag_name}}.zip
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
# Compile le CSS depuis les sources LESS (gitignored)
|
||||
- name: Setup Node.js
|
||||
uses: https://github.com/actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- name: Build CSS
|
||||
run: npx gulp css
|
||||
run: npm install && npm run build
|
||||
|
||||
- name: Set system.json URLs and version
|
||||
run: |
|
||||
set -e
|
||||
TAG="${{ github.event.release.tag_name }}"
|
||||
VERSION="${TAG#v}"
|
||||
BASE_URL="https://www.uberwald.me/gitea/uberwald/fvtt-prism-rpg"
|
||||
# Manifest and download point to the release assets (substituted values, not raw git)
|
||||
MANIFEST="${BASE_URL}/releases/download/${TAG}/system.json"
|
||||
DOWNLOAD="${BASE_URL}/releases/download/${TAG}/fvtt-prism-rpg.zip"
|
||||
# Crée le zip de release avec tous les fichiers nécessaires au système
|
||||
- run: |
|
||||
apt update -y
|
||||
apt install -y zip
|
||||
|
||||
sed -i "s|#{MANIFEST}#|${MANIFEST}|g" system.json
|
||||
sed -i "s|#{DOWNLOAD}#|${DOWNLOAD}|g" system.json
|
||||
sed -i "s|#{URL}#|${BASE_URL}|g" system.json
|
||||
sed -i "s|\"version\": \"[^\"]*\"|\"version\": \"${VERSION}\"|g" system.json
|
||||
- run: zip -r ./fvtt-prism-rpg-${{github.event.release.tag_name}}.zip system.json fvtt-prism-rpg.mjs assets/ css/ lang/ module/ styles/ templates/
|
||||
|
||||
echo "--- system.json after substitution ---"
|
||||
cat system.json
|
||||
- name: setup go
|
||||
uses: https://github.com/actions/setup-go@v4
|
||||
with:
|
||||
go-version: ">=1.20.1"
|
||||
|
||||
- name: Package release archive
|
||||
run: |
|
||||
set -e
|
||||
zip -r fvtt-prism-rpg.zip \
|
||||
assets/ \
|
||||
css/ \
|
||||
lang/ \
|
||||
module/ \
|
||||
templates/ \
|
||||
prism-rpg.mjs \
|
||||
system.json \
|
||||
LICENSE \
|
||||
README.md \
|
||||
changelog.md
|
||||
- name: Use Go Action
|
||||
id: use-go-action
|
||||
uses: https://gitea.com/actions/release-action@main
|
||||
with:
|
||||
files: |-
|
||||
./fvtt-prism-rpg-${{github.event.release.tag_name}}.zip
|
||||
system.json
|
||||
api_key: "${{secrets.RELEASE_PRISM }}"
|
||||
|
||||
- name: Upload release assets
|
||||
run: |
|
||||
set -e
|
||||
RELEASE_ID="${{ github.event.release.id }}"
|
||||
GITEA_URL="https://www.uberwald.me/gitea"
|
||||
REPO="uberwald/fvtt-prism-rpg"
|
||||
|
||||
# Upload fvtt-prism-rpg.zip
|
||||
curl -sf -X POST \
|
||||
"${GITEA_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=fvtt-prism-rpg.zip" \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_PRISM }}" \
|
||||
-H "Content-Type: application/zip" \
|
||||
--data-binary @fvtt-prism-rpg.zip
|
||||
|
||||
# Upload system.json (manifest direct URL)
|
||||
curl -sf -X POST \
|
||||
"${GITEA_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=system.json" \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_PRISM }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data-binary @system.json
|
||||
#- name: Publish to Foundry server
|
||||
# uses: https://github.com/djlechuck/foundryvtt-publish-package-action@v1
|
||||
# with:
|
||||
# token: ${{ secrets.FOUNDRYVTT_RELEASE_TOKEN }}
|
||||
# id: "fvtt-prism-rpg"
|
||||
# version: ${{github.event.release.tag_name}}
|
||||
# manifest: "https://www.uberwald.me/gitea/${{gitea.repository}}/releases/download/latest/system.json"
|
||||
# notes: "https://www.uberwald.me/gitea/${{gitea.repository}}/releases/download/${{github.event.release.tag_name}}/fvtt-prism-rpg-${{github.event.release.tag_name}}.zip"
|
||||
# compatibility-minimum: "14"
|
||||
# compatibility-verified: "14"
|
||||
|
||||
Reference in New Issue
Block a user