Skip to content

Commit

Permalink
Merge pull request #13 from sparkfabrik/fix/fix_pipeline
Browse files Browse the repository at this point in the history
Fix pipeline
  • Loading branch information
Monska85 authored Jan 26, 2024
2 parents 33bdc61 + 0080484 commit 5804f70
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 deletions.
46 changes: 26 additions & 20 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,27 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
# set latest tag for main branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', env.RELEASE_BRANCH) }}
type=sha,format=long,prefix=
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Get variables
id: vars
run: |
echo "latest_image_tag=$(make print-latest-image-tag)" >> "$GITHUB_OUTPUT"
echo "aws_cli_version=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[1]}')" >> "$GITHUB_OUTPUT"
echo "alpine_version=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[2]}')" >> "$GITHUB_OUTPUT"
echo "static_tag=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[1]}')-alpine$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[2]}')" >> "$GITHUB_OUTPUT"
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.vars.outputs.static_tag }},enable=${{ github.ref == format('refs/heads/{0}', env.RELEASE_BRANCH) }}
# set latest tag for main branch and if the static_tag is the latest version configured in the Makefile
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', env.RELEASE_BRANCH) && steps.vars.outputs.static_tag == steps.vars.outputs.latest_image_tag }}
type=sha,format=long,prefix=${{ steps.vars.outputs.static_tag }}-
- name: Build Docker image
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -75,24 +78,27 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
# set latest tag for main branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', env.RELEASE_BRANCH) }}
type=sha,format=long,prefix=
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Get variables
id: vars
run: |
echo "latest_image_tag=$(make print-latest-image-tag)" >> "$GITHUB_OUTPUT"
echo "aws_cli_version=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[1]}')" >> "$GITHUB_OUTPUT"
echo "alpine_version=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[2]}')" >> "$GITHUB_OUTPUT"
echo "static_tag=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[1]}')-alpine$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[2]}')" >> "$GITHUB_OUTPUT"
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.vars.outputs.static_tag }},enable=${{ github.ref == format('refs/heads/{0}', env.RELEASE_BRANCH) }}
# set latest tag for main branch and if the static_tag is the latest version configured in the Makefile
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', env.RELEASE_BRANCH) && steps.vars.outputs.static_tag == steps.vars.outputs.latest_image_tag }}
type=sha,format=long,prefix=${{ steps.vars.outputs.static_tag }}-
- name: Build Docker image
uses: docker/build-push-action@v5
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
AUTHOR ?= sparkfabrik
IMAGE_NAME ?= docker-alpine-aws-cli
PLATFORM ?= "linux/amd64"
LATEST_VERSION ?= 2.15.14-alpine3.18

build: build-2.15.14-3.18

Expand Down Expand Up @@ -37,3 +38,6 @@ build-template:
--build-arg ALPINE_VERSION=$(ALPINE_VERSION) \
--build-arg AWS_CLI_VERSION=$(AWS_CLI_VERSION) \
-t $(AUTHOR)/$(IMAGE_NAME):$(AWS_CLI_VERSION)-alpine$(ALPINE_VERSION)

print-latest-image-tag:
@echo $(LATEST_VERSION)

0 comments on commit 5804f70

Please sign in to comment.