Files
rhema-together/.gitea/workflows/release.yaml
T
vhaudiquet 22c838eafe ci: use the job token for package pushes
The workflow already requests packages: write, so the built-in Gitea token can log in to the container and Helm registries. This avoids a repository secret that does not exist yet.
2026-11-28 11:48:48 +01:00

96 lines
3.0 KiB
YAML

# The release channel: a v* tag ships the exact-version image, the
# rolling stable pin, and the exact-version chart. A tag with a
# pre-release suffix publishes nothing. Edge publishing on every main
# push lives in ci.yml.
name: release
on:
push:
tags:
- "v*"
permissions:
contents: read
packages: write
env:
REGISTRY: git.vhaudiquet.fr
OWNER: vhaudiquet
RHEMA_REF: v0.5.1
jobs:
verify-tag:
# The binary and the chart both take their version from the
# manifest, not the tag. A mismatch must fail before anything ships.
runs-on: ubuntu-latest
steps:
- uses: https://gitea.com/actions/checkout@v4
- name: Check the tag matches the package version
run: |
crate_version="$(grep -m1 '^version =' Cargo.toml | awk -F'"' '{print $2}')"
tag_version="${GITHUB_REF_NAME#v}"
if [ "$crate_version" != "$tag_version" ]; then
echo "tag $GITHUB_REF_NAME does not match package version $crate_version" >&2
exit 1
fi
publish-release-image:
if: ${{ !contains(gitea.ref_name, '-') }}
needs: verify-tag
runs-on: ubuntu-latest
steps:
- uses: https://gitea.com/actions/checkout@v4
- name: Log in to the container registry
uses: docker/login-action@v3
with:
registry: https://git.vhaudiquet.fr
username: ${{ gitea.actor }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Compute the release version
id: ver
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
build-args: |
RHEMA_REF=${{ env.RHEMA_REF }}
tags: |
git.vhaudiquet.fr/${{ env.OWNER }}/rhema-together:${{ steps.ver.outputs.version }}
git.vhaudiquet.fr/${{ env.OWNER }}/rhema-together:stable
git.vhaudiquet.fr/${{ env.OWNER }}/rhema-together:${{ gitea.sha }}
publish-release-chart:
if: ${{ !contains(gitea.ref_name, '-') }}
needs: publish-release-image
runs-on: ubuntu-latest
steps:
- uses: https://gitea.com/actions/checkout@v4
- name: Install Helm
uses: azure/setup-helm@v5
- name: Stamp the chart with the release version and commit
run: |
sed -i "s/^version:.*/version: \"${GITHUB_REF_NAME#v}\"/" deploy/helm/rhema-together/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: \"${{ gitea.sha }}\"/" deploy/helm/rhema-together/Chart.yaml
- name: Lint and package
run: |
helm lint deploy/helm/rhema-together --strict
helm package deploy/helm/rhema-together
- name: Push the chart to the Gitea Helm registry
run: |
TOKEN=$(echo -n "${{ secrets.GITEA_TOKEN }}" | tr -d '\n')
curl --fail --user "${{ gitea.actor }}:${TOKEN}" \
-X POST \
--upload-file rhema-together-*.tgz \
"https://git.vhaudiquet.fr/api/packages/${{ env.OWNER }}/helm/api/charts"