Compare commits
6 Commits
29938d7a0c
...
0.39
| Author | SHA1 | Date | |
|---|---|---|---|
| 96c14f0b22 | |||
| 6d7dbfa624 | |||
| c00111cff1 | |||
| d263d8a534 | |||
| af030c8255 | |||
| ad127d36ea |
@@ -39,10 +39,10 @@ jobs:
|
|||||||
GITEA_TOKEN: ${{ secrets.GITOPS_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITOPS_TOKEN }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install git, curl, ca-certificates
|
- name: Install git, curl, ca-certificates, jq
|
||||||
run: |
|
run: |
|
||||||
apt-get update -qq
|
apt-get update -qq
|
||||||
apt-get install -y --no-install-recommends git curl ca-certificates
|
apt-get install -y --no-install-recommends git curl ca-certificates jq
|
||||||
|
|
||||||
- name: Install tea
|
- name: Install tea
|
||||||
run: |
|
run: |
|
||||||
@@ -62,19 +62,29 @@ jobs:
|
|||||||
id: resolve
|
id: resolve
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
GIT_TAG="${{ inputs.tag }}"
|
IMAGE="gitea.home.hrajfrisbee.cz/${{ github.repository }}:${{ inputs.tag }}-go"
|
||||||
else
|
else
|
||||||
# workflow_run: use the ref name of the triggering workflow (the pushed git tag).
|
# workflow_run: head_branch is not populated for tag pushes in Gitea Actions.
|
||||||
GIT_TAG="${{ github.event.workflow_run.head_branch }}"
|
# Look up the tag name that points to the triggering commit SHA via the API.
|
||||||
|
SHA="${{ github.event.workflow_run.head_sha }}"
|
||||||
|
GIT_TAG=$(curl -fsSL \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
"https://gitea.home.hrajfrisbee.cz/api/v1/repos/${{ github.repository }}/tags?limit=50" \
|
||||||
|
| jq -r --arg sha "$SHA" '.[] | select(.commit.sha == $sha) | .name')
|
||||||
|
IMAGE="gitea.home.hrajfrisbee.cz/${{ github.repository }}:${GIT_TAG}-go"
|
||||||
fi
|
fi
|
||||||
IMAGE="gitea.home.hrajfrisbee.cz/${{ github.repository }}:${GIT_TAG}-go"
|
|
||||||
echo "image=${IMAGE}" >> "$GITHUB_OUTPUT"
|
echo "image=${IMAGE}" >> "$GITHUB_OUTPUT"
|
||||||
echo "Resolved image: ${IMAGE}"
|
echo "Resolved image: ${IMAGE}"
|
||||||
|
|
||||||
- name: Configure git identity
|
- name: Configure git identity and credentials
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "uh-cli bot"
|
git config --global user.name "uh-cli bot"
|
||||||
git config --global user.email "bot@hrajfrisbee.cz"
|
git config --global user.email "bot@hrajfrisbee.cz"
|
||||||
|
# Store credentials separately so the --git-repo URL stays clean.
|
||||||
|
# Tea matches the login URL against the remote URL; embedded credentials
|
||||||
|
# break that matching and cause "path segment [0] is empty" on pr create.
|
||||||
|
git config --global credential.helper store
|
||||||
|
echo "https://kacerr:${GITEA_TOKEN}@gitea.home.hrajfrisbee.cz" >> ~/.git-credentials
|
||||||
|
|
||||||
- name: Authenticate tea
|
- name: Authenticate tea
|
||||||
run: |
|
run: |
|
||||||
@@ -85,10 +95,11 @@ jobs:
|
|||||||
|
|
||||||
- name: Open image-update PR (or dry run)
|
- name: Open image-update PR (or dry run)
|
||||||
run: |
|
run: |
|
||||||
|
set -x
|
||||||
uh-cli -v gitops deployment update \
|
uh-cli -v gitops deployment update \
|
||||||
--deployment-name fuj-management \
|
--deployment-name fuj-management \
|
||||||
--deployment-namespace fuj \
|
--deployment-namespace fuj \
|
||||||
--set-image "${{ steps.resolve.outputs.image }}" \
|
--set-image "${{ steps.resolve.outputs.image }}" \
|
||||||
--git-repo "https://kacerr:${GITEA_TOKEN}@gitea.home.hrajfrisbee.cz/kacerr/home-kubernetes" \
|
--git-repo "https://gitea.home.hrajfrisbee.cz/kacerr/home-kubernetes" \
|
||||||
--git-path gitops/home-kubernetes \
|
--git-path gitops/home-kubernetes \
|
||||||
${{ (github.event_name == 'workflow_dispatch' && inputs.dry_run == 'true') && '--dry-run' || '' }}
|
${{ (github.event_name == 'workflow_dispatch' && inputs.dry_run == 'true') && '--dry-run' || '' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user