Add Forgejo CI workflow to build and release the plugin
Some checks failed
Build plugin / build (push) Failing after 1m25s
Some checks failed
Build plugin / build (push) Failing after 1m25s
This commit is contained in:
parent
6ede5ae10e
commit
ebbe3da28b
1 changed files with 67 additions and 0 deletions
67
.forgejo/workflows/build.yml
Normal file
67
.forgejo/workflows/build.yml
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
name: Build plugin
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [trunk]
|
||||||
|
tags: ["v*"]
|
||||||
|
pull_request:
|
||||||
|
branches: [trunk]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: [docker, ubuntu-24.04]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update -qq
|
||||||
|
sudo apt-get install -y -qq make git wget unzip
|
||||||
|
|
||||||
|
- name: Install Godot
|
||||||
|
run: |
|
||||||
|
wget -q https://github.com/godotengine/godot/releases/download/4.4.1-stable/Godot_v4.4.1-stable_linux.x86_64.zip
|
||||||
|
unzip -q Godot_v4.4.1-stable_linux.x86_64.zip
|
||||||
|
mkdir -p "$HOME/.local/bin"
|
||||||
|
mv Godot_v4.4.1-stable_linux.x86_64 "$HOME/.local/bin/godot"
|
||||||
|
chmod +x "$HOME/.local/bin/godot"
|
||||||
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
GODOT: godot
|
||||||
|
run: make dist
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: itch-${{ github.ref_name || github.sha }}
|
||||||
|
path: dist/itch.zip
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
TAG="${GITHUB_REF_NAME}"
|
||||||
|
API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
||||||
|
|
||||||
|
# Create the release
|
||||||
|
curl -sf -X POST "${API}/releases" \
|
||||||
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\"}" \
|
||||||
|
-o /tmp/release.json
|
||||||
|
|
||||||
|
RELEASE_ID=$(python3 -c "import json; print(json.load(open('/tmp/release.json'))['id'])")
|
||||||
|
|
||||||
|
# Upload assets
|
||||||
|
for FILE in dist/itch.zip dist/itch.zip.sha256.txt; do
|
||||||
|
NAME=$(basename "$FILE")
|
||||||
|
curl -sf -X POST \
|
||||||
|
"${API}/releases/${RELEASE_ID}/assets?name=${NAME}" \
|
||||||
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@${FILE}"
|
||||||
|
done
|
||||||
Loading…
Add table
Add a link
Reference in a new issue