-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Push images to docker hub and ghcr
- Loading branch information
Fritz Durchardt
committed
Aug 28, 2023
1 parent
c3aeac6
commit 22ec6b4
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: flow-build | ||
|
||
on: | ||
push: | ||
branches: [ "release-2.0" ] | ||
pull_request: | ||
branches: [ "release-2.0" ] | ||
|
||
jobs: | ||
docker-buildx: | ||
runs-on: ubuntu-latest | ||
env: | ||
image_name: myks | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- 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_TOKEN }} | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
docker.io/enopsre/${{ env.image_name }} | ||
ghcr.io/mykso/${{ env.image_name }} | ||
tags: | | ||
# set latest tag for default branch | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: ${{ env.platforms }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |