Add github action to build deploystatic container
authorMagnus Hagander <magnus@hagander.net>
Thu, 20 Feb 2025 18:54:11 +0000 (19:54 +0100)
committerMagnus Hagander <magnus@hagander.net>
Thu, 20 Feb 2025 19:25:38 +0000 (20:25 +0100)
Builds the container and publishes it to the github container
registry. Also schedules a rebuild once a month to pick up updates to
the base packages.

.github/workflows/deploystatic-container.yaml [new file with mode: 0644]

diff --git a/.github/workflows/deploystatic-container.yaml b/.github/workflows/deploystatic-container.yaml
new file mode 100644 (file)
index 0000000..965f7ae
--- /dev/null
@@ -0,0 +1,46 @@
+name: Publish deploystatic container
+on:
+  push:
+    branches:
+      - master
+      - main
+    paths:
+      - tools/deploystatic/**
+  # Allow manual run
+  workflow_dispatch:
+  # Schedule a run once a month to get updated base packages
+  schedule:
+    - cron: "0 0 1 * *"
+
+env:
+  REGISTRY: ghcr.io
+  IMAGE_NAME: ${{ github.repository }}
+
+jobs:
+  build-and-push-deploystatic-image:
+    runs-on: ubuntu-latest
+
+    permissions:
+      contents: read
+      packages: write
+      attestations: write
+      id-token: write
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+
+      - name: Log in to the container registry
+        uses: docker/login-action@v3
+        with:
+          registry: ${{ env.REGISTRY }}
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Build and push docker image
+        id: push
+        uses: docker/build-push-action@v6
+        with:
+          context: tools/deploystatic
+          push: true
+          tags: ghcr.io/${{ github.repository_owner }}/deploystatic:latest , ghcr.io/${{ github.repository_owner }}/deploystatic:${{ github.sha }}