Skip to content

Commit c02be36

Browse files
committed
build: add manual pipeline trigger to rebuild latest image
[skip ci]
1 parent 9bdbc3c commit c02be36

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Rebuild Latest Image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
reason:
7+
description: 'Reason for the rebuild'
8+
required: true
9+
default: 'Hotfix for current version'
10+
11+
permissions:
12+
packages: write
13+
contents: read
14+
attestations: write
15+
id-token: write
16+
17+
jobs:
18+
build-and-publish:
19+
name: Rebuild & Publish
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v5
24+
with:
25+
ref: main
26+
27+
- name: Read version from config
28+
id: get_version
29+
run: |
30+
# distinct from the node script, we use jq for a quick read without dependency install
31+
VERSION=$(jq -r .version config/hawki_version.json)
32+
33+
if [ -z "$VERSION" ] || [ "$VERSION" == "null" ]; then
34+
echo "Error: Could not read version from config/hawki_version.json"
35+
exit 1
36+
fi
37+
38+
echo "Detected version: $VERSION"
39+
echo "version=$VERSION" >> $GITHUB_OUTPUT
40+
41+
- name: Set up QEMU
42+
uses: docker/setup-qemu-action@v3
43+
44+
- name: Set up Docker Buildx
45+
uses: docker/setup-buildx-action@v3
46+
47+
- name: Log in to Docker Hub
48+
uses: docker/login-action@v3
49+
with:
50+
username: ${{ secrets.DOCKER_USERNAME }}
51+
password: ${{ secrets.DOCKER_PASSWORD }}
52+
53+
- name: Build and push Docker image
54+
id: push
55+
uses: docker/build-push-action@v5
56+
with:
57+
context: .
58+
file: ./Dockerfile
59+
push: true
60+
target: app_prod
61+
platforms: linux/amd64,linux/arm64
62+
tags: |
63+
digitalenvironments/hawki:latest
64+
digitalenvironments/hawki:${{ steps.get_version.outputs.version }}
65+
cache-from: type=gha,scope=${{ steps.get_version.outputs.version }}
66+
cache-to: type=gha,mode=max,scope=${{ steps.get_version.outputs.version }}
67+
68+
- name: Generate artifact attestation
69+
uses: actions/attest-build-provenance@v1
70+
with:
71+
subject-name: index.docker.io/digitalenvironments/hawki
72+
subject-digest: ${{ steps.push.outputs.digest }}
73+
push-to-registry: true
74+
75+
- name: Notify Discord (Rebuild)
76+
if: success()
77+
uses: ./.github/actions/setup-release-environment
78+
working-directory: .github/.release
79+
env:
80+
INPUT_WEBHOOK_URL: ${{ secrets.DISCORD_UPDATE_WEBHOOK_URL }}
81+
# We pass dummy values for release info as there is no new Github Release
82+
INPUT_RELEASE_NAME: "Hotfix Rebuild: v${{ steps.get_version.outputs.version }}"
83+
INPUT_RELEASE_BODY: "Manual rebuild triggering by workflow dispatch. Reason: ${{ inputs.reason }}"
84+
INPUT_RELEASE_URL: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
85+
INPUT_CONTENT: "||@everyone|| ⚠️ **HAWKI v${{ steps.get_version.outputs.version }}** has been rebuilt and republished (Hotfix)."
86+
run: node send-discord-notification.js

0 commit comments

Comments
 (0)