forked from enviPath/enviPy
[Fix] Fix Image Tags (#445)
Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#445
This commit is contained in:
@ -1,8 +1,7 @@
|
|||||||
name: Build Docker Image
|
name: Build Docker Image
|
||||||
|
|
||||||
# Trigger manually or when a PR to main is completed.
|
# Trigger when a PR to main/develop is completed.
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
@ -12,7 +11,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
|
if: ${{ github.event.pull_request.merged == true }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# Fetch the repository content for the Docker build context.
|
# Fetch the repository content for the Docker build context.
|
||||||
@ -32,19 +31,18 @@ jobs:
|
|||||||
password: ${{ secrets.CI_REGISTRY_PASSWORD }}
|
password: ${{ secrets.CI_REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
# Generate image tags/labels:
|
# Generate image tags/labels:
|
||||||
# - main branch gets stable "envipy" and "latest" tags
|
# - PRs targeting main get "latest" and "main-sha"
|
||||||
# - every build gets an increasing build number tag
|
# - PRs targeting develop get "dev" and "dev-sha"
|
||||||
# - branch-prefixed commit SHA tag remains for traceability
|
|
||||||
- name: Extract metadata
|
- name: Extract metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: git.envipath.com/envipath/envipy
|
images: git.envipath.com/envipath/envipy
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=envipy,enable=${{ github.ref_name == 'main' }}
|
type=raw,value=latest,enable=${{ github.event.pull_request.base.ref == 'main' }}
|
||||||
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
|
type=sha,prefix=main-,enable=${{ github.event.pull_request.base.ref == 'main' }}
|
||||||
type=raw,value=build-${{ github.run_number }}
|
type=raw,value=dev,enable=${{ github.event.pull_request.base.ref == 'develop' }}
|
||||||
type=sha,prefix={{branch}}-
|
type=sha,prefix=dev-,enable=${{ github.event.pull_request.base.ref == 'develop' }}
|
||||||
|
|
||||||
# Load SSH key so Docker can pull private git+ssh dependencies during build.
|
# Load SSH key so Docker can pull private git+ssh dependencies during build.
|
||||||
- name: Setup SSH for private git dependencies
|
- name: Setup SSH for private git dependencies
|
||||||
|
|||||||
Reference in New Issue
Block a user