forked from djmaze/swarmdns
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 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,54 @@ | ||
name: Build Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- feature/* | ||
tags: | ||
- '*' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
DOCKER_TAG: latest | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to GHCR | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set feature tag | ||
if: ${{ startsWith(github.ref, 'refs/heads/feature/') }} | ||
run: echo DOCKER_TAG=$(echo ${{ github.ref }} | sed 's|refs/heads/||g' | sed 's|/|-|g') >> ${GITHUB_ENV} | ||
|
||
- name: Set versioned tag | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
run: echo DOCKER_TAG=$(echo ${{ github.ref }} | sed 's|refs/tags/||g') >> ${GITHUB_ENV} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }} | ||
platforms: | | ||
linux/amd64 | ||
linux/arm64 |