Promote tag-derived php-homepage chart releases
Publish PHP Apache image / Build, test and push (push) Failing after 44s
Publish PHP Apache image / Build, test and push (push) Failing after 44s
This commit is contained in:
@@ -9,6 +9,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE: registry.brunner.ninja/feedc0de/php-apache
|
IMAGE: registry.brunner.ninja/feedc0de/php-apache
|
||||||
|
GITOPS_REPOSITORY: feedc0de/homelab-gitops
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
@@ -17,8 +18,10 @@ jobs:
|
|||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out source
|
- name: Check out source and tags
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up Helm
|
- name: Set up Helm
|
||||||
uses: azure/setup-helm@v4
|
uses: azure/setup-helm@v4
|
||||||
@@ -125,11 +128,8 @@ jobs:
|
|||||||
test -n "${php_version}"
|
test -n "${php_version}"
|
||||||
version_tag="${apache_version}-${php_version}"
|
version_tag="${apache_version}-${php_version}"
|
||||||
printf 'VERSION_TAG=%s\n' "${version_tag}" >> "${GITHUB_ENV}"
|
printf 'VERSION_TAG=%s\n' "${version_tag}" >> "${GITHUB_ENV}"
|
||||||
run_attempt="${GITHUB_RUN_ATTEMPT:-1}"
|
chart_version="$(./scripts/chart-version.sh)"
|
||||||
test -n "${GITHUB_RUN_NUMBER}"
|
|
||||||
chart_version="0.${GITHUB_RUN_NUMBER}.${run_attempt}"
|
|
||||||
printf 'CHART_VERSION=%s\n' "${chart_version}" >> "${GITHUB_ENV}"
|
printf 'CHART_VERSION=%s\n' "${chart_version}" >> "${GITHUB_ENV}"
|
||||||
printf 'BUILD_TAG=chart-%s\n' "${chart_version}" >> "${GITHUB_ENV}"
|
|
||||||
|
|
||||||
- name: Push commit tag
|
- name: Push commit tag
|
||||||
if: gitea.event_name == 'push'
|
if: gitea.event_name == 'push'
|
||||||
@@ -143,15 +143,13 @@ jobs:
|
|||||||
COMMIT_SHA: ${{ gitea.sha }}
|
COMMIT_SHA: ${{ gitea.sha }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
docker tag "${IMAGE}:${COMMIT_SHA}" "${IMAGE}:${BUILD_TAG}"
|
|
||||||
docker tag "${IMAGE}:${COMMIT_SHA}" "${IMAGE}:${VERSION_TAG}"
|
docker tag "${IMAGE}:${COMMIT_SHA}" "${IMAGE}:${VERSION_TAG}"
|
||||||
docker tag "${IMAGE}:${COMMIT_SHA}" "${IMAGE}:latest"
|
docker tag "${IMAGE}:${COMMIT_SHA}" "${IMAGE}:latest"
|
||||||
docker push "${IMAGE}:${BUILD_TAG}"
|
|
||||||
docker push "${IMAGE}:${VERSION_TAG}"
|
docker push "${IMAGE}:${VERSION_TAG}"
|
||||||
docker push "${IMAGE}:latest"
|
docker push "${IMAGE}:latest"
|
||||||
|
|
||||||
- name: Publish Helm chart
|
- name: Publish Helm chart
|
||||||
if: gitea.ref == 'refs/heads/main' || gitea.event_name == 'schedule'
|
if: gitea.ref == 'refs/heads/main'
|
||||||
env:
|
env:
|
||||||
PACKAGE_USERNAME: ${{ secrets.PACKAGE_USERNAME }}
|
PACKAGE_USERNAME: ${{ secrets.PACKAGE_USERNAME }}
|
||||||
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
||||||
@@ -163,7 +161,7 @@ jobs:
|
|||||||
helm package helm/php-homepage \
|
helm package helm/php-homepage \
|
||||||
--destination .chart-packages \
|
--destination .chart-packages \
|
||||||
--version "${CHART_VERSION}" \
|
--version "${CHART_VERSION}" \
|
||||||
--app-version "${BUILD_TAG}"
|
--app-version "${COMMIT_SHA}"
|
||||||
chart_file=".chart-packages/php-homepage-${CHART_VERSION}.tgz"
|
chart_file=".chart-packages/php-homepage-${CHART_VERSION}.tgz"
|
||||||
test -f "${chart_file}"
|
test -f "${chart_file}"
|
||||||
curl --fail --silent --show-error \
|
curl --fail --silent --show-error \
|
||||||
@@ -171,3 +169,29 @@ jobs:
|
|||||||
--request POST \
|
--request POST \
|
||||||
--upload-file "${chart_file}" \
|
--upload-file "${chart_file}" \
|
||||||
https://code.brunner.ninja/api/packages/feedc0de/helm/api/charts
|
https://code.brunner.ninja/api/packages/feedc0de/helm/api/charts
|
||||||
|
|
||||||
|
- name: Check out GitOps repository
|
||||||
|
if: gitea.ref == 'refs/heads/main'
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: ${{ env.GITOPS_REPOSITORY }}
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.GITOPS_TOKEN }}
|
||||||
|
path: homelab-gitops
|
||||||
|
|
||||||
|
- name: Promote the exact chart to every homepage application
|
||||||
|
if: gitea.ref == 'refs/heads/main'
|
||||||
|
working-directory: homelab-gitops
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
for application in \
|
||||||
|
brgkepler-com brunner-ninja gschissenes-equipment \
|
||||||
|
immich-crack pfostendynamics-com watschn-studio; do
|
||||||
|
./scripts/update-chart-version.sh "${application}" "${CHART_VERSION}"
|
||||||
|
git add "bootstrap/${application}.yaml"
|
||||||
|
done
|
||||||
|
git config user.name "feedc0de"
|
||||||
|
git config user.email "feedc0de@users.noreply.code.brunner.ninja"
|
||||||
|
if git diff --cached --quiet; then exit 0; fi
|
||||||
|
git commit -m "Deploy php-homepage chart ${CHART_VERSION}"
|
||||||
|
git push origin HEAD:main
|
||||||
|
|||||||
Executable
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
description=$(git describe --tags --long --match 'v[0-9]*' --dirty)
|
||||||
|
case "$description" in
|
||||||
|
*-dirty) echo "refusing to package a dirty tree" >&2; exit 1 ;;
|
||||||
|
esac
|
||||||
|
version=${description#v}
|
||||||
|
case "$version" in
|
||||||
|
*-0-g*) version=${version%%-0-g*} ;;
|
||||||
|
esac
|
||||||
|
printf '%s\n' "$version"
|
||||||
Reference in New Issue
Block a user