forked from kylemanna/docker-openvpn
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added workflow for automatically building and pushing image on main branch push or tag push
- Loading branch information
Showing
1 changed file
with
58 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,58 @@ | ||
name: build-image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '[0-9]+.*' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Convert repository name ot image name | ||
id: image_name | ||
run: | | ||
sed -E -e 's/docker-//' -e 's/^/image_name=/' <<<"${{ gitea.repository }}" >> "$GITHUB_OUTPUT" | ||
- name: Generate Docker tag names | ||
id: meta | ||
uses: https://gitea.com/zcube/metadata-action@gitea | ||
with: | ||
# list of Docker images to use as base name for tags | ||
images: | | ||
gitea.local.salvoxia.de/${{ steps.image_name.outputs.image_name }} | ||
# generate Docker tags based on the following events/attributes | ||
tags: | | ||
# set latest tag for default branch | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
# Tags for non SemVer tag names | ||
type=match,pattern=([0-9]+.*),group=1 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to local registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: gitea.local.salvoxia.de | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.REGISTRY_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
# Workaround until a new version of build-push-action is released | ||
env: | ||
ACTIONS_RUNTIME_TOKEN: '' | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64,linux/arm | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} |