From 1f72cfc75e2a92fbabd9f6e2bbdf1acdee19dc76 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Tue, 3 May 2022 23:34:53 +0200 Subject: [PATCH] Set up automated build --- .github/workflows/build.yml | 82 +++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e0f8839 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,82 @@ +name: Build Image + +on: + push: + tags: [ '*' ] + pull_request: + branches: [ main ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: linux-surface/grub-aarch64 + + +jobs: + build-grub: + name: Build GRUB Container + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v1 + + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v2 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + + build-image: + name: Build GRUB AArch64 Image + + if: ${{ github.event_name != 'pull_request' }} + needs: [build-grub] + + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Build GRUB AArch64 Image + run: | + docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} + docker run --rm -v "${PWD}/":/output \ + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} \ + aarch64-grub-mkimage \ + -O arm64-efi \ + -o /output/bootaa64.efi \ + --prefix= \ + $(cat modules.txt) + + - name: Publish Release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: bootaa64.efi + tag: ${{ github.ref }}