Skip to content

Commit

Permalink
build server image for more tags with server- prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
siliconbrain committed Feb 15, 2022
1 parent 1069363 commit 6231ba1
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Server Image
on:
push:
branches:
- master
- master
tags:
- server-v[0-9].[0-9].[0-9]+
- server-v[0-9]+.[0-9]+.[0-9]+*
env:
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7

Expand All @@ -16,7 +16,6 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
Expand All @@ -28,36 +27,23 @@ jobs:
key: ${{ runner.os }}-buildx-${{ github.ref }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Determine tag or commit
uses: haya14busa/action-cond@v1
id: refortag
with:
cond: ${{ startsWith(github.ref, 'refs/tags/') }}
if_true: ${{ github.ref }}
if_false: latest
- name: Determine image tag
id: imagetag
run: echo "::set-output name=value::$(echo ${TAG_OR_BRANCH##*/}| sed 's/server-//g')"
env:
TAG_OR_BRANCH: ${{ steps.refortag.outputs.value }}
- name: Path from tag
id: pathfromtag
run: echo "::set-output name=value::$(echo $TAG | sed -E 's/^(v[0-9]+\.v[0-9]+\.[0-9]+).*/\1/')"
run: echo "::set-output name=value::$(if [ $REF_TYPE = tag ]; then echo $REF_NAME | sed 's/server-//g'; elif [ $REF_NAME = master ]; then echo latest; else echo $REF_NAME; fi)"
env:
TAG: ${{ steps.imagetag.outputs.value }}
REF_NAME: ${{ github.ref_name }}
REF_TYPE: ${{ github.ref_type }}
- name: Build Server
uses: docker/build-push-action@v2
with:
context: tunnel/
tags: ghcr.io/banzaicloud/kurun-server:${{ steps.pathfromtag.outputs.value }}
tags: ghcr.io/banzaicloud/kurun-server:${{ steps.imagetag.outputs.value }}
file: tunnel/Dockerfile.server
platforms: ${{ env.PLATFORMS }}
push: true
Expand Down

0 comments on commit 6231ba1

Please sign in to comment.