generated from MrSphay/codex-agent-repository-kit
80 lines
2.4 KiB
YAML
80 lines
2.4 KiB
YAML
name: Build MrTrust
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
|
|
- name: Build Windows EXE
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
version="0.1.2"
|
|
dotnet publish src/MrTrustLauncher.csproj \
|
|
--configuration Release \
|
|
--runtime win-x64 \
|
|
--output dist/build \
|
|
-p:EnableWindowsTargeting=true \
|
|
-p:PublishSingleFile=true \
|
|
-p:SelfContained=true
|
|
cp dist/build/MrTrust.exe dist/MrTrust.exe
|
|
|
|
- name: Build release ZIP
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
version="0.1.2"
|
|
package_root="dist/MrTrust-${version}"
|
|
rm -rf "$package_root" "dist/MrTrust-${version}.zip"
|
|
mkdir -p "$package_root"
|
|
cp dist/MrTrust.exe "$package_root/"
|
|
cp README.md "$package_root/"
|
|
(cd dist && zip -r "MrTrust-${version}.zip" "MrTrust-${version}")
|
|
|
|
- name: Show package contents
|
|
shell: bash
|
|
run: |
|
|
find dist -maxdepth 4 -type f -printf '%p %s bytes\n'
|
|
|
|
- name: Upload release artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: MrTrust-0.1.2
|
|
path: dist/MrTrust-0.1.2.zip
|
|
|
|
- name: Attach ZIP to Gitea release
|
|
if: github.ref == 'refs/heads/main'
|
|
shell: bash
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
version="0.1.2"
|
|
api="http://gitea:3000/api/v1/repos/${GITHUB_REPOSITORY}"
|
|
release_json="$(curl -fsS -H "Authorization: token ${GITEA_TOKEN}" "${api}/releases/tags/v${version}")"
|
|
release_id="$(printf '%s' "$release_json" | sed -n 's/.*"id":\([0-9][0-9]*\).*/\1/p' | head -n 1)"
|
|
if [ -z "$release_id" ]; then
|
|
echo "Could not resolve release id for v${version}" >&2
|
|
exit 1
|
|
fi
|
|
curl -fsS \
|
|
-X POST \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-F "attachment=@dist/MrTrust-${version}.zip" \
|
|
"${api}/releases/${release_id}/assets?name=MrTrust-${version}.zip"
|