Skip to content

feat: build multi-arch docker images #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,24 @@ jobs:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Build Docker image
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Get variables
run: |
VERSION=$(grep "docker://quay.io/terraform-docs/gh-actions" action.yml | cut -d: -f4 | sed 's/"//g')
docker build --pull --tag quay.io/terraform-docs/gh-actions:${VERSION} .
image_version=$(grep "docker://quay.io/terraform-docs/gh-actions" action.yml | cut -d: -f4 | sed 's/"//g')
echo "image_version=${image_version}" >> "$GITHUB_ENV"
- name: Build Docker images
uses: docker/build-push-action@v6
with:
outputs: "type=image"
platforms: linux/amd64,linux/arm64
push: false
tags: quay.io/${{ github.event.repository.name }}/gh-actions:${{ env.image_version }}

- name: Should generate USAGE.md for tf11_basic
uses: ./
Expand Down Expand Up @@ -94,6 +108,7 @@ jobs:
git-commit-message: "terraform-docs: automated action"

- name: Should generate README.md for tf12_fail_diff and fail on diff
continue-on-error: true
uses: ./
with:
working-dir: examples/tf12_fail_diff
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker
uses: docker/login-action@v3
if: env.REGISTRY_USERNAME != ''
Expand All @@ -23,11 +29,14 @@ jobs:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build Docker image
- name: Build and push Docker image
if: env.REGISTRY_USERNAME != ''
run: |
docker build --pull --tag quay.io/terraform-docs/gh-actions:edge .
docker push quay.io/terraform-docs/gh-actions:edge
uses: docker/build-push-action@v6
with:
outputs: "type=registry"
platforms: linux/amd64,linux/arm64
push: true
tags: quay.io/${{ github.event.repository.name }}/gh-actions:edge

release-draft:
runs-on: ubuntu-latest
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ env:
jobs:
release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
permissions:
contents: write
steps:
Expand Down Expand Up @@ -68,6 +67,12 @@ jobs:
release_version="${{ inputs.version }}"
echo "release_version=${release_version//v/}" >> "$GITHUB_ENV"

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker
uses: docker/login-action@v3
if: env.REGISTRY_USERNAME != ''
Expand All @@ -76,13 +81,14 @@ jobs:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build Docker image
- name: Build and push Docker image
if: env.REGISTRY_USERNAME != ''
run: |
docker build --pull --tag quay.io/terraform-docs/gh-actions:${{ env.release_version }} .
docker build --pull --tag quay.io/terraform-docs/gh-actions:latest .
docker push quay.io/terraform-docs/gh-actions:${{ env.release_version }}
docker push quay.io/terraform-docs/gh-actions:latest
uses: docker/build-push-action@v6
with:
outputs: "type=registry"
platforms: linux/amd64,linux/arm64
push: true
tags: quay.io/${{ github.event.repository.name }}/gh-actions:latest,quay.io/${{ github.event.repository.name }}/gh-actions:${{ env.release_version }}

update-tag:
runs-on: ubuntu-latest
Expand Down
Loading