Compare commits
2 Commits
c00111cff1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 96c14f0b22 | |||
| 6d7dbfa624 |
@@ -63,11 +63,3 @@ jobs:
|
|||||||
--build-arg BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
|
--build-arg BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
|
||||||
-t $IMAGE go/
|
-t $IMAGE go/
|
||||||
docker push $IMAGE
|
docker push $IMAGE
|
||||||
echo "$IMAGE" > /tmp/go-image-tag.txt
|
|
||||||
|
|
||||||
- name: Upload Go image tag for gitops workflow
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: go-image-tag
|
|
||||||
path: /tmp/go-image-tag.txt
|
|
||||||
retention-days: 1
|
|
||||||
|
|||||||
@@ -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: |
|
||||||
@@ -58,21 +58,20 @@ jobs:
|
|||||||
-o /usr/local/bin/uh-cli
|
-o /usr/local/bin/uh-cli
|
||||||
chmod +x /usr/local/bin/uh-cli
|
chmod +x /usr/local/bin/uh-cli
|
||||||
|
|
||||||
- name: Download image tag artifact (workflow_run trigger)
|
|
||||||
if: github.event_name == 'workflow_run'
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: go-image-tag
|
|
||||||
run-id: ${{ github.event.workflow_run.id }}
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Resolve image tag
|
- name: Resolve image tag
|
||||||
id: resolve
|
id: resolve
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
IMAGE="gitea.home.hrajfrisbee.cz/${{ github.repository }}:${{ inputs.tag }}-go"
|
IMAGE="gitea.home.hrajfrisbee.cz/${{ github.repository }}:${{ inputs.tag }}-go"
|
||||||
else
|
else
|
||||||
IMAGE="$(cat go-image-tag.txt)"
|
# workflow_run: head_branch is not populated for tag pushes in Gitea Actions.
|
||||||
|
# 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
|
||||||
echo "image=${IMAGE}" >> "$GITHUB_OUTPUT"
|
echo "image=${IMAGE}" >> "$GITHUB_OUTPUT"
|
||||||
echo "Resolved image: ${IMAGE}"
|
echo "Resolved image: ${IMAGE}"
|
||||||
|
|||||||
Reference in New Issue
Block a user