ci: publish the image and chart from CI
ci / checks (push) Failing after 1m26s
ci / chart (push) Canceled after 0s
ci / web (push) Canceled after 0s
ci / docker (push) Canceled after 0s
ci / publish-edge-image (push) Canceled after 0s
ci / publish-edge-chart (push) Canceled after 0s
ci / test (push) Canceled after 1m26s
ci / checks (push) Failing after 1m26s
ci / chart (push) Canceled after 0s
ci / web (push) Canceled after 0s
ci / docker (push) Canceled after 0s
ci / publish-edge-image (push) Canceled after 0s
ci / publish-edge-chart (push) Canceled after 0s
ci / test (push) Canceled after 1m26s
Build and test the server, client, and chart on every push. Main pushes publish the rolling image and a timestamped chart whose appVersion is the commit; v* tags publish exact and stable image tags.
This commit is contained in:
1 parent
7f494b28de
commit
51b7a5e80b
4 files changed
+334
No files matched your search
@@ -0,0 +1,95 @@
|
||||
# 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.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
|
||||
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.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"
|
||||
Reference in new issue
Block a user