60 lines
2.1 KiB
YAML
60 lines
2.1 KiB
YAML
name: Release
|
|
|
|
# Tinggal bikin tag: git tag v1.2.0 && git push --tags
|
|
# Versi AppImage diambil dari nama tag, jadi tidak perlu ubah file apa pun.
|
|
on:
|
|
push:
|
|
tags: ["v*"]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install build dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends \
|
|
libgl1-mesa-dev libx11-dev xorg-dev libxkbcommon-dev libwayland-dev
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
|
|
- name: Test
|
|
run: go test ./...
|
|
|
|
- name: Build AppImage
|
|
env:
|
|
# build.sh menyisipkan info update zsync yang mengarah ke rilis di Gitea.
|
|
GITEA_BASE: ${{ github.server_url }}/${{ github.repository }}
|
|
run: |
|
|
VERSION="${GITHUB_REF_NAME#v}" ./build.sh
|
|
ls -lh dist/lazyrun-*.AppImage*
|
|
|
|
- name: Create release
|
|
env:
|
|
TOKEN: ${{ github.token }}
|
|
run: |
|
|
API="${GITHUB_API_URL:-${GITHUB_SERVER_URL}/api/v1}"
|
|
TAG="${GITHUB_REF_NAME}"
|
|
cat > /tmp/body.md <<'EOF'
|
|
Single-file AppImage for Linux x86_64. No root needed, everything stays in
|
|
`~/.local/` and `~/.config/lazyrun/`.
|
|
|
|
Already using LazyRun? It upgrades itself from this release page.
|
|
EOF
|
|
python3 -c 'import json,sys;print(json.dumps({"tag_name":sys.argv[1],"name":"LazyRun "+sys.argv[1],"body":open(sys.argv[2]).read()}))' "$TAG" /tmp/body.md > /tmp/rel.json
|
|
RID=$(curl -sf -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" "$API/repos/$GITHUB_REPOSITORY/releases" --data @/tmp/rel.json | python3 -c 'import json,sys;print(json.load(sys.stdin)["id"])')
|
|
echo "release id=$RID"
|
|
for f in dist/lazyrun-*.AppImage dist/lazyrun-*.AppImage.zsync; do
|
|
[ -f "$f" ] || continue
|
|
curl -sf -X POST -H "Authorization: token $TOKEN" -F "attachment=@$f" "$API/repos/$GITHUB_REPOSITORY/releases/$RID/assets?name=$(basename "$f")" -o /dev/null
|
|
done
|