Skip to content

Commit

Permalink
Add semver support on python-app action
Browse files Browse the repository at this point in the history
  • Loading branch information
b0l0k committed Oct 17, 2023
1 parent 11f544d commit 01e4371
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
7 changes: 6 additions & 1 deletion python-app/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ inputs:
description: "args to pass to docker build"
required: false
default: ""
outputs:
semantic-version:
description: "Extracted Semantic version."
value: ${{ steps.docker.outputs.semantic-version }}

runs:
using: "composite"
Expand All @@ -52,7 +56,8 @@ runs:
GOSS_IMAGE: goss_image:latest
GOSS_FILES_PATH: .github/goss

- uses: LedgerHQ/actions/python-app/docker@main
- uses: LedgerHQ/actions/python-app/docker@add-reusable-workflow-helm
id: docker
with:
build-args: ${{ inputs.docker-build-args }}

Expand Down
28 changes: 23 additions & 5 deletions python-app/docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ inputs:
description: "args to pass to docker build"
required: false
default: ""
outputs:
semantic-version:
description: "Extracted Semantic version."
value: ${{ steps.extract-semantic-version.outputs.semantic-version }}

runs:
using: "composite"
Expand All @@ -32,19 +36,33 @@ runs:
echo VERSION=$(git describe --tags) >> $GITHUB_ENV
shell: bash

- if: ${{ steps.check-docker.outputs.is-docker-needed == 'true' }}
name: Semantic Version preparation
id: extract-semantic-version
env:
REF: ${{ github.event.pull_request && github.head_ref || github.ref_name }}
run: |
if [[ $REF =~ ^[0-9]+\.[0-9]+\.[0-9]+(.*)$ ]]; then
echo "semantic-version=$REF" >> ${GITHUB_OUTPUT}
else
echo "semantic-version=0.0.0-${REF//[\/_]/-}" >> ${GITHUB_OUTPUT}
fi
shell: bash

- if: ${{ steps.check-docker.outputs.is-docker-needed == 'true' }}
name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.IMAGE }}
flavor: |
latest=false
latest=false
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=semver,pattern={{version}},value=${{steps.extract-semantic-version.outputs.semantic-version}}
- if: ${{ steps.check-docker.outputs.is-docker-needed == 'true' }}
name: Set up QEMU
Expand Down

0 comments on commit 01e4371

Please sign in to comment.