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: workflow_dispatch:
jobs: jobs:
release-candidate: tag-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: if: github.event_name == 'push'
contents: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with: { fetch-depth: 0 }
fetch-depth: 0 - name: Auto-tag
- name: Create Gitea tag and release candidate
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
set -euo pipefail set -e
TAG="v0.1.0-rc.${{ github.run_number }}" TAG="0.0.${{ github.run_number }}"
TARGET="${{ github.sha }}" git tag "$TAG" || true
TAG_URL="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/tags" git push origin "$TAG" || true
RELEASE_URL="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" echo "tag=$TAG" >> "$GITHUB_OUTPUT"
printf '{"tag_name":"%s","target":"%s","message":"Automated release candidate %s"}\n' \ draft-rc:
"$TAG" "$TARGET" "$TAG" > /tmp/tag.json runs-on: ubuntu-latest
curl --fail-with-body -sS -X POST "$TAG_URL" \ needs: tag-release
-H "Authorization: token $TOKEN" \ steps:
-H "Content-Type: application/json" \ - uses: actions/checkout@v4
--data-binary @/tmp/tag.json with: { fetch-depth: 0 }
- name: Draft release
printf '{"tag_name":"%s","target_commitish":"%s","name":"Release Candidate %s","body":"Automated release candidate for commit %s.","draft":false,"prerelease":true}\n' \ run: |
"$TAG" "$TARGET" "$TAG" "$TARGET" > /tmp/release.json set -e
curl --fail-with-body -sS -X POST "$RELEASE_URL" \ TAG="${{ needs.tag-release.outputs.tag }}"
-H "Authorization: token $TOKEN" \ gh release create "$TAG" --draft --title "RC $TAG" --notes "Automated release candidate for $TAG." || true
-H "Content-Type: application/json" \ env:
--data-binary @/tmp/release.json 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