Snake/.gitea/workflows/build.yml

66 lines
3.2 KiB
YAML
Raw Normal View History

2023-04-02 20:44:55 +00:00
name: "godot-ci export"
on: push
jobs:
export_game:
runs-on: ubuntu-latest
name: Export Game Job
2023-04-02 20:44:55 +00:00
steps:
- name: checkout
uses: https://github.com/actions/checkout@v3.3.0
- name: install packages
id: wine_install
2023-04-02 20:48:07 +00:00
run: |
apt update -y && apt upgrade -y
apt install -y wine64 nodejs p7zip-full ca-certificates tree jq curl
echo "WINE_PATH=$(which wine64)" >> $GITHUB_OUTPUT
- name: download godot build libs
run: |
mkdir -p /root/.local/share/godot/
wget -nv https://downloads.tuxfamily.org/godotengine/4.0/Godot_v4.0-stable_linux.x86_64.zip -O "/root/.local/share/godot/godot.zip"
wget -nv https://downloads.tuxfamily.org/godotengine/4.0/Godot_v4.0-stable_export_templates.tpz -O /root/.local/share/godot/godot_templates.tpz
- name: setup godot build libs
run: |
7z x /root/.local/share/godot/godot.zip -o/root/.local/share/godot/godot_executable -y
chmod +x /root/.local/share/godot/godot_executable/Godot_v4.0-stable_linux.x86_64
unzip /root/.local/share/godot/godot_templates.tpz -d /root/.local/share/godot
mv /root/.local/share/godot/templates /root/.local/share/godot/4.0.stable
mkdir -p /root/.local/share/godot/export_templates
mv /root/.local/share/godot/4.0.stable /root/.local/share/godot/export_templates
/root/.local/share/godot/godot_executable/Godot_v4.0-stable_linux.x86_64 --version
- name: export for linux
run: |
mkdir -p ./builds/linux/
/root/.local/share/godot/godot_executable/Godot_v4.0-stable_linux.x86_64 /var/lib/actions/project.godot --headless -q --export-release Linux/X11 ./builds/linux/Game.x86_64
- name: package for linux
run: |
cd builds
tar -czvf linux.tar.gz -C linux/ .
- name: create release
run: |
echo "Getting last Release Tag"
VERSION=$(curl -X 'GET' 'https://git.euph.dev/api/v1/repos/${{ github.repository }}/releases?page=1&limit=1' -H 'accept: application/json')
VERSION=$(echo $VERSION | jq -r '.[0].tag_name' | awk -F. -v OFS=. '{$NF += 1 ; print}')
echo "Generate new Release"
ID=$(curl -X 'POST' \
'https://git.euph.dev/api/v1/repos/${{ github.repository }}/releases' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: token ${{ secrets.RELEASE_TOKEN }}' \
-d "{
\"body\": \"Automated Build\",
\"draft\": true,
\"name\": \"Automated Release $VERSION\",
\"prerelease\": true,
\"tag_name\": \"$VERSION\"
}")
echo $ID
ID=$(echo $ID | jq -r '.id')
echo "Uploading Build to Release"
curl -X 'POST' \
"https://git.euph.dev/api/v1/repos/${{ github.repository }}/releases/$ID/assets?name=Linux.tar.gz" \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-H 'Authorization: token ${{ secrets.RELEASE_TOKEN }}' \
-F 'attachment=@./builds/linux.tar.gz;type=application/gzip'