59 lines
1.9 KiB
YAML
59 lines
1.9 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
name: Build App
|
|
runs-on: docker
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Checkout assets
|
|
run: git -c submodule."assets".update=checkout submodule update --init assets
|
|
|
|
- name: Install pnpm
|
|
run: npm install -g pnpm@10.18.1
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Build Linux
|
|
run: pnpm exec electron-forge make --platform linux --arch x64 --targets @electron-forge/maker-zip
|
|
|
|
- name: Build Windows
|
|
run: pnpm exec electron-forge make --platform win32 --arch x64 --targets @electron-forge/maker-zip
|
|
|
|
- name: Create release and upload artifacts
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
RESPONSE=$(curl -sf -X POST \
|
|
"https://git.mithraic.cloud/api/v1/repos/ad3laid3/sanctum/releases" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"Sanctum $TAG\",\"draft\":false,\"prerelease\":false}")
|
|
|
|
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
|
|
echo "Created release ID: $RELEASE_ID"
|
|
|
|
find out/make -type f -name "*.zip" | while read FILE; do
|
|
NAME=$(basename "$FILE")
|
|
echo "Uploading $NAME..."
|
|
curl -sf -X POST \
|
|
"https://git.mithraic.cloud/api/v1/repos/ad3laid3/sanctum/releases/$RELEASE_ID/assets?name=$NAME" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
--data-binary "@$FILE"
|
|
done
|