Commit f0fb483442b54f5fac26aae8a4f920ea10f0196b

Mark Cave-Ayland 2022-01-26T11:12:13

.github/workflows: add main.yml for building fcode-utils upon push This is a GitHub push action that generates a container image from docker/Dockerfile using the fcode-utils-builder image and pushes the result to ghcr.io/openbios/fcode-utils:master for public use. It is essentially a standard Debian 11.2 image with the binaries copied into /usr/bin. Note that this action also creates a zip artifact containing the binaries and localvariables directories to allow simple build testing and verification upon merge. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..b1ad525
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,54 @@
+name: Build fcode-utils
+
+on: [push, workflow_dispatch]
+
+env:
+  REGISTRY: ghcr.io
+  IMAGE_NAME: ${{ github.repository }}
+
+jobs:
+  build-x86_64:
+    runs-on: ubuntu-latest
+    name: fcode-utils for x86_64
+    steps:
+      - name: Checkout fcode-utils
+        uses: actions/checkout@v2
+
+      - name: Log in to the Container registry
+        uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
+        with:
+          registry: ${{ env.REGISTRY }}
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Extract metadata (tags, labels) for Docker
+        id: meta
+        uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
+        with:
+          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+
+      - name: Build fcode-utils
+        uses: docker://ghcr.io/openbios/fcode-utils-builder:master
+        with:
+          args: "bash -c \"mkdir -p $(pwd)/build-$(uname -m) && make && make DESTDIR=$(pwd)/build-$(uname -m) install\""
+
+      - name: Copy localvalues
+        uses: docker://ghcr.io/openbios/fcode-utils-builder:master
+        with:
+          args: "bash -c \"cp -R localvalues build-$(uname -m)\""
+
+      - name: Store x86_64 artifacts
+        uses: actions/upload-artifact@v2
+        with:
+          name: fcode-utils-x86_64
+          path: |
+            build-x86_64
+
+      - name: Build and push Docker image
+        uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
+        with:
+          context: .
+          file: docker/Dockerfile
+          push: true
+          tags: ${{ steps.meta.outputs.tags }}
+          labels: ${{ steps.meta.outputs.labels }}
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..9401b13
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,3 @@
+FROM debian:11.2
+
+COPY build-x86_64/bin/* /usr/bin