Initial Coworker app scaffold
This commit is contained in:
72
.gitea/workflows/release.yml
Normal file
72
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,72 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Validate
|
||||
run: npm run release:check
|
||||
|
||||
- name: Build Windows installer
|
||||
run: |
|
||||
docker run --rm \
|
||||
-v "$PWD":/project \
|
||||
-w /project \
|
||||
electronuserland/builder:wine \
|
||||
/bin/bash -lc "npm run package:win"
|
||||
|
||||
- name: Checksums
|
||||
run: |
|
||||
cd release
|
||||
sha256sum Coworker-Setup-*.exe > SHA256SUMS.txt
|
||||
|
||||
- name: Create Gitea release and upload assets
|
||||
run: |
|
||||
test -n "$GITEA_TOKEN"
|
||||
server="${GITHUB_SERVER_URL:-https://git.wilkensxl.de}"
|
||||
repo="${GITHUB_REPOSITORY:-Code-Inc/Coworker}"
|
||||
tag="${GITHUB_REF_NAME:-manual}"
|
||||
body="$(python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
print(Path("docs/release-notes.md").read_text(encoding="utf-8"))
|
||||
PY
|
||||
)"
|
||||
release_json="$(python3 - <<PY
|
||||
import json, os
|
||||
print(json.dumps({
|
||||
"tag_name": os.environ.get("tag", "$tag"),
|
||||
"target_commitish": "main",
|
||||
"name": "$tag",
|
||||
"body": """$body""",
|
||||
"draft": False,
|
||||
"prerelease": False
|
||||
}))
|
||||
PY
|
||||
)"
|
||||
response="$(curl --fail-with-body -sS \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$release_json" \
|
||||
"$server/api/v1/repos/$repo/releases")"
|
||||
release_id="$(printf '%s' "$response" | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')"
|
||||
for file in release/Coworker-Setup-*.exe release/SHA256SUMS.txt; do
|
||||
name="$(basename "$file")"
|
||||
curl --fail-with-body -sS \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-F "attachment=@$file" \
|
||||
"$server/api/v1/repos/$repo/releases/$release_id/assets?name=$name"
|
||||
done
|
||||
Reference in New Issue
Block a user