Skip to content

Commit

Permalink
Add semver release with major, minor, latest
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkgroenen committed Jan 22, 2024
1 parent 45a5a74 commit 225e2f5
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,30 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: check if a version tag
- name: check if a version tag
id: check-version-tag
run: |
if [[ ${{ github.event.client_payload.tag }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo ::set-output name=match::true
fi
-
name: Sleep for 900s
- name: Sleep for 900s
if: steps.check-version-tag.outputs.match == 'true'
uses: juliangruber/sleep-action@v1
with:
time: 900s
-
name: check if a version tag in ref
- name: check if a version tag in ref
if: steps.check-version-tag.outputs.match == 'true'
id: get-version-tag-in-ref
run: |
if [[ ${{ github.event.client_payload.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo ::set-output name=versiontag::$(echo "${{github.event.client_payload.ref}}" | cut -d / -f 3)
fi
-
name: Checkout
- name: Checkout
if: github.event.client_payload.tag == steps.get-version-tag-in-ref.outputs.versiontag
uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.ref }}
-
name: Docker meta
- name: Docker meta
if: github.event.client_payload.tag == steps.get-version-tag-in-ref.outputs.versiontag
id: meta
uses: docker/metadata-action@v4
Expand All @@ -45,27 +40,25 @@ jobs:
sodadata/soda-core
tags: |
type=raw,value=${{ github.event.client_payload.tag }}
-
name: Set up QEMU
type=semver,pattern=v{{major}}.{{minor}},value=${{ github.event.client_payload.tag }}
type=semver,pattern=v{{major}},value=${{ github.event.client_payload.tag }}
- name: Set up QEMU
if: github.event.client_payload.tag == steps.get-version-tag-in-ref.outputs.versiontag
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
if: github.event.client_payload.tag == steps.get-version-tag-in-ref.outputs.versiontag
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
- name: Login to DockerHub
if: github.event.client_payload.tag == steps.get-version-tag-in-ref.outputs.versiontag
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
- name: Build and push
if: github.event.client_payload.tag == steps.get-version-tag-in-ref.outputs.versiontag
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 225e2f5

Please sign in to comment.