mirror of
https://github.com/Dasemu/Maskarr.git
synced 2026-11-26 15:26:10 +00:00
feat: create a release on main in Gitea and GitHub workflows
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2463a700dd
commit
2f34fab341
4 files changed
+55
-1
No files matched your search
@@ -65,6 +65,22 @@ jobs:
|
|||||||
git pull --rebase origin ${{ gitea.ref_name }}
|
git pull --rebase origin ${{ gitea.ref_name }}
|
||||||
git push origin HEAD:${{ gitea.ref_name }}
|
git push origin HEAD:${{ gitea.ref_name }}
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
if: gitea.ref_name == 'main'
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ gitea.token }}
|
||||||
|
TAG: v${{ steps.version.outputs.new }}
|
||||||
|
API: ${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}
|
||||||
|
run: |
|
||||||
|
status=$(curl -s -o /dev/null -w '%{http_code}' -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG")
|
||||||
|
if [ "$status" = "200" ]; then
|
||||||
|
echo "Release $TAG already exists, skipping"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
curl -sf -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\": \"$TAG\", \"target_commitish\": \"$(git rev-parse HEAD)\", \"name\": \"$TAG\", \"body\": \"Release $TAG\"}" \
|
||||||
|
"$API/releases"
|
||||||
|
|
||||||
- name: Merge main back into development
|
- name: Merge main back into development
|
||||||
if: gitea.ref_name == 'main'
|
if: gitea.ref_name == 'main'
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -22,3 +22,40 @@ jobs:
|
|||||||
# No linter or test suite is configured for this project yet.
|
# No linter or test suite is configured for this project yet.
|
||||||
# This is a lightweight sanity check (syntax/import compile), not a test run.
|
# This is a lightweight sanity check (syntax/import compile), not a test run.
|
||||||
- run: python3 -m py_compile maskarr.py
|
- run: python3 -m py_compile maskarr.py
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: check
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
# The version bump lands as a later "chore(release)" commit on main, so
|
||||||
|
# wait for it and release that commit instead of the pre-bump one.
|
||||||
|
- name: Resolve release commit
|
||||||
|
id: rel
|
||||||
|
run: |
|
||||||
|
sha="${{ github.sha }}"
|
||||||
|
for i in $(seq 1 30); do
|
||||||
|
git fetch -q origin main
|
||||||
|
bump=$(git log --reverse --format='%H %s' "$sha..origin/main" | grep -m1 ' chore(release): v' | cut -d' ' -f1 || true)
|
||||||
|
if [ -n "$bump" ]; then sha="$bump"; break; fi
|
||||||
|
sleep 20
|
||||||
|
done
|
||||||
|
echo "sha=$sha" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "version=$(git show "$sha:VERSION")" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
tag="v${{ steps.rel.outputs.version }}"
|
||||||
|
if gh release view "$tag" >/dev/null 2>&1; then
|
||||||
|
echo "Release $tag already exists, skipping"
|
||||||
|
else
|
||||||
|
gh release create "$tag" --target "${{ steps.rel.outputs.sha }}" --title "$tag" --generate-notes
|
||||||
|
fi
|
||||||
@@ -22,7 +22,7 @@ Everything lives in `maskarr.py`: an `http.server`-based proxy that forwards req
|
|||||||
- No `development` branch exists yet; CI and the version workflow reference it per the standard shape, but they won't trigger until it's created.
|
- No `development` branch exists yet; CI and the version workflow reference it per the standard shape, but they won't trigger until it's created.
|
||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
Docker image published to GHCR only, on push to `main`/tags (`.github/workflows/docker-publish.yml`). Version workflow lives in `.gitea/workflows/`; CI runs in both `.gitea/workflows/` and `.github/workflows/`. See `docs/deployment.md` for systemd and Docker instructions.
|
Docker image published to GHCR only, on push to `main`/tags (`.github/workflows/docker-publish.yml`). Version workflow lives in `.gitea/workflows/`; CI runs in both `.gitea/workflows/` and `.github/workflows/`. On pushes to `main`, a `vX.Y.Z` release is created on Gitea (last step of `version.yml`, after the bump) and on GitHub (`release` job in `.github/workflows/ci.yml`, which waits for the bump commit). See `docs/deployment.md` for systemd and Docker instructions.
|
||||||
|
|
||||||
## Gotchas
|
## Gotchas
|
||||||
- `maskarr_config.json` is tracked as an empty template; don't commit it populated with real tracker credentials/cookies.
|
- `maskarr_config.json` is tracked as an empty template; don't commit it populated with real tracker credentials/cookies.
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ docker run -d \
|
|||||||
The GitHub Actions workflow `.github/workflows/docker-publish.yml` publishes the Docker image to
|
The GitHub Actions workflow `.github/workflows/docker-publish.yml` publishes the Docker image to
|
||||||
**GitHub Container Registry** (`ghcr.io`) on each push to `main`/`master` or tag `v*.*.*`.
|
**GitHub Container Registry** (`ghcr.io`) on each push to `main`/`master` or tag `v*.*.*`.
|
||||||
CI and versioning run on Gitea Actions (`.gitea/workflows/` (CI also runs on GitHub)).
|
CI and versioning run on Gitea Actions (`.gitea/workflows/` (CI also runs on GitHub)).
|
||||||
|
Every push to `main` creates a `vX.Y.Z` tag and release on both Gitea (`version.yml`, after the version bump) and GitHub (`release` job in `ci.yml`).
|
||||||
|
|
||||||
### Using published images
|
### Using published images
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user