Compare commits

..

No commits in common. "ce376aaa6e03f4fe18b64365b402395904498451" and "0cb4c0c1cf24031b310948969cfcc6099d47851f" have entirely different histories.

2 changed files with 22 additions and 51 deletions

View File

@ -6,35 +6,30 @@ on:
workflow_dispatch:
jobs:
release-candidate:
tag-release:
runs-on: ubuntu-latest
permissions:
contents: write
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Gitea tag and release candidate
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: { fetch-depth: 0 }
- name: Auto-tag
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"
set -e
TAG="0.0.${{ github.run_number }}"
git tag "$TAG" || true
git push origin "$TAG" || true
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
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
draft-rc:
runs-on: ubuntu-latest
needs: tag-release
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- name: Draft release
run: |
set -e
TAG="${{ needs.tag-release.outputs.tag }}"
gh release create "$TAG" --draft --title "RC $TAG" --notes "Automated release candidate for $TAG." || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,24 +0,0 @@
from pathlib import Path
WORKFLOW = Path(".gitea/workflows/release.yml")
def test_release_workflow_uses_gitea_api_not_github_cli():
text = WORKFLOW.read_text()
assert "gh release" not in text
assert "/api/v1/repos/${{ github.repository }}/tags" in text
assert "/api/v1/repos/${{ github.repository }}/releases" in text
def test_release_workflow_targets_merge_commit_and_marks_rc():
text = WORKFLOW.read_text()
assert 'TARGET="${{ github.sha }}"' in text
assert '"prerelease":true' in text
assert '"draft":false' in text
def test_release_workflow_fails_on_api_error():
text = WORKFLOW.read_text()
assert "curl --fail-with-body" in text
assert "|| true" not in text