Compare commits

6 Commits
5 changed files with 62 additions and 2 deletions

No files matched your search

+22
View File
@@ -7,6 +7,10 @@ on:
permissions: permissions:
contents: write contents: write
concurrency:
group: version-${{ gitea.ref_name }}
cancel-in-progress: false
jobs: jobs:
bump: bump:
if: ${{ !contains(gitea.event.head_commit.message, '[skip ci]') && gitea.actor != 'gitea-actions' }} if: ${{ !contains(gitea.event.head_commit.message, '[skip ci]') && gitea.actor != 'gitea-actions' }}
@@ -14,6 +18,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
ref: ${{ gitea.ref_name }}
fetch-depth: 0 fetch-depth: 0
token: ${{ gitea.token }} token: ${{ gitea.token }}
@@ -57,8 +62,25 @@ jobs:
run: | run: |
git add VERSION git add VERSION
git commit -m "chore(release): v${{ steps.version.outputs.new }} [skip ci]" git commit -m "chore(release): v${{ steps.version.outputs.new }} [skip ci]"
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: |
+37
View File
@@ -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
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -1 +1 @@
0.2.0 0.4.0
+1
View File
@@ -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