Attach Windows builds to Gitea release
All checks were successful
build-windows-exe / build (push) Successful in 1m5s
All checks were successful
build-windows-exe / build (push) Successful in 1m5s
This commit is contained in:
@@ -2,6 +2,8 @@ name: build-windows-exe
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -11,7 +13,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 https://git.vrcworldtour.com/every_holiday/VRCWT-OSC.git .
|
git clone --depth 1 --branch "${GITHUB_REF_NAME}" https://git.vrcworldtour.com/every_holiday/VRCWT-OSC.git .
|
||||||
|
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -43,8 +45,32 @@ jobs:
|
|||||||
cp config/guests.example.txt dist/guests.example.txt
|
cp config/guests.example.txt dist/guests.example.txt
|
||||||
(cd dist && zip -r vrc_osc-windows.zip vrc_osc.exe vrwt_tool.exe config.example.toml secrets.example.toml guests.example.txt)
|
(cd dist && zip -r vrc_osc-windows.zip vrc_osc.exe vrwt_tool.exe config.example.toml secrets.example.toml guests.example.txt)
|
||||||
|
|
||||||
- name: Verify archive
|
- name: Create Release
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
GITEA_BASE_URL: ${{ secrets.GITEA_BASE_URL }}
|
||||||
|
TAG_NAME: ${{ github.ref_name }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd VRWT_Tool/VRC_OSC/dist
|
set -euo pipefail
|
||||||
ls -l vrc_osc-windows.zip
|
api="${GITEA_BASE_URL:-https://git.vrcworldtour.com}/api/v1"
|
||||||
|
owner_repo="every_holiday/VRCWT-OSC"
|
||||||
|
release_json=$(curl -fsSL \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"${api}/repos/${owner_repo}/releases/tags/${TAG_NAME}" || true)
|
||||||
|
if [ -n "${release_json}" ]; then
|
||||||
|
release_id=$(printf '%s' "${release_json}" | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')
|
||||||
|
else
|
||||||
|
release_json=$(curl -fsSL -X POST \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\":\"${TAG_NAME}\",\"name\":\"${TAG_NAME}\",\"draft\":false,\"prerelease\":false}" \
|
||||||
|
"${api}/repos/${owner_repo}/releases")
|
||||||
|
release_id=$(printf '%s' "${release_json}" | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')
|
||||||
|
fi
|
||||||
|
asset_path="VRWT_Tool/VRC_OSC/dist/vrc_osc-windows.zip"
|
||||||
|
curl -fsSL -X POST \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-F "attachment=@${asset_path}" \
|
||||||
|
"${api}/repos/${owner_repo}/releases/${release_id}/assets?name=vrc_osc-windows.zip"
|
||||||
|
|||||||
Reference in New Issue
Block a user