forked from vhaudiquet/rhema-together
The manifest pointed at `../rhema`, so a build needed that checkout beside the repository. CI cloned it in two jobs and the Dockerfile cloned a tag and rewrote the paths. The committed lock had drifted to 0.5.1 entries after the framework bumped to 0.5.2, so the first cargo command in a clean tree rewrote it. All twelve crates are on crates.io at 0.5.2, so the manifest names that version and the lock pins it. The clone steps, the `RHEMA_REF` argument, and the path rewrite are gone from the workflows and the image. Moving the framework now means `cargo update` on the `rhema-*` packages.
93 lines
3.0 KiB
YAML
93 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
|
|
|
|
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.PACKAGES_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
|
|
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.PACKAGES_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"
|