41 lines
1.4 KiB
YAML
41 lines
1.4 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
release-candidate:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Create Gitea tag and release candidate
|
|
env:
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
TAG="v0.1.0-rc.${{ github.run_number }}"
|
|
TARGET="${{ github.sha }}"
|
|
TAG_URL="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/tags"
|
|
RELEASE_URL="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases"
|
|
|
|
printf '{"tag_name":"%s","target":"%s","message":"Automated release candidate %s"}\n' \
|
|
"$TAG" "$TARGET" "$TAG" > /tmp/tag.json
|
|
curl --fail-with-body -sS -X POST "$TAG_URL" \
|
|
-H "Authorization: token $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
--data-binary @/tmp/tag.json
|
|
|
|
printf '{"tag_name":"%s","target_commitish":"%s","name":"Release Candidate %s","body":"Automated release candidate for commit %s.","draft":false,"prerelease":true}\n' \
|
|
"$TAG" "$TARGET" "$TAG" "$TARGET" > /tmp/release.json
|
|
curl --fail-with-body -sS -X POST "$RELEASE_URL" \
|
|
-H "Authorization: token $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
--data-binary @/tmp/release.json
|