Skip to content

Commit

Permalink
feat: build for multiple target architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
whefter committed Sep 18, 2023
1 parent d29a0a3 commit a40e43a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 13 deletions.
32 changes: 25 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,31 @@ jobs:
name: build and publish Docker image
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
whefter/cron
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{raw}}
type=raw,value=latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: '386,amd64,arm64,arm'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: whefter/cron
tags: latest
tag_with_ref: true
push: ${{ startsWith(github.ref, 'refs/tags/') }}
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7,linux/386
21 changes: 15 additions & 6 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,30 @@ jobs:
name: build and publish Docker image
steps:
- name: checkout code to list tags
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: '386,amd64,arm64,arm'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: set latest tag var
id: latestTag
run: echo ::set-output name=tag::$(git tag -l 'v*' --sort=taggerdate | tail -n 1)
- name: checkout latest tag
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ steps.latestTag.outputs.tag }}
- name: build and push docker images
uses: docker/build-push-action@v1
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: whefter/cron
tags: latest,${{ steps.latestTag.outputs.tag }}
- name: build and push docker images
uses: docker/build-push-action@v5
with:
push: true
tags: whefter/cron:latest,whefter/cron:${{ steps.latestTag.outputs.tag }}
platforms: linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7,linux/386

0 comments on commit a40e43a

Please sign in to comment.