From d8182820a447da13355ebab29d3938280ccaea8c Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Thu, 21 Mar 2024 13:10:19 -0700 Subject: [PATCH] Add an initial minimal workflow to build gantry as a container --- .github/workflows/ci.yml | 10 ++++++++++ .github/workflows/container.yml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/container.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43b8230..448ea9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,7 @@ jobs: outputs: style: ${{ steps.filter.outputs.style }} unit-tests: ${{ steps.filter.outputs.unit-tests }} + container: ${{ steps.filter.outputs.container }} steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # @v2 if: ${{ github.event_name == 'push' }} @@ -38,6 +39,10 @@ jobs: - '.github/**' - 'gantry/**' - 'pyproject.toml' + container: + - '.github/workflows/**' + - 'gantry/**' + - 'pyproject.toml' style: if: ${{ needs.changes.outputs.style == 'true' }} @@ -48,3 +53,8 @@ jobs: if: ${{ needs.changes.outputs.unit-tests == 'true' }} needs: [changes, style] uses: ./.github/workflows/unit-tests.yml + + container: + if: ${{ needs.changes.outputs.container == 'true' }} + needs: [changes, style, unit-tests] + uses: ./.github/workflows/container.yml diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml new file mode 100644 index 0000000..e5c421a --- /dev/null +++ b/.github/workflows/container.yml @@ -0,0 +1,32 @@ +name: Container Build & Publish +on: + workflow_call: + +jobs: + build-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 + - uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 + + - name: Login to GitHub Container Registry + uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Tag Metadata for Container + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 + id: metadata + with: + images: ghcr.io/${{ github.repository }} + + - name: Build and push image + uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: ${{ github.ref == 'refs/heads/develop' }} + tags: ${{ steps.metadata.outputs.tags }}