Skip to content

Commit

Permalink
feat(ci): add version tag to images
Browse files Browse the repository at this point in the history
  • Loading branch information
brucetony committed Jan 16, 2025
1 parent 3fcf45e commit b8265c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
with:
context: .
file: ${{ inputs.docker_file }}
tags: ${{ inputs.image_tags }}
tags: ${{ steps.tag_suffix.outputs.tags }}
labels: ${{ inputs.image_labels }}
platforms: ${{ inputs.platforms }}
push: true
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
branches:
- '**'
pull_request:
branches: [ develop ]

jobs:
metadata:
Expand All @@ -17,6 +18,15 @@ jobs:
image_tags: ${{ steps.meta.outputs.tags }}
image_labels: ${{ steps.meta.outputs.labels }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Get Version
id: get-version
uses: beaconbrigade/[email protected]
with:
path: .

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
Expand All @@ -25,15 +35,16 @@ jobs:
tags: |
type=sha
type=edge
type=semver,pattern={{version}}
type=raw,value=canary,enable=${{ contains(github.event.head_commit.message, 'build_image') }}
type=raw,value=latest,enable=${{ github.event.pull_request.merged == true }}
type=semver,pattern={{version}},value=${{ steps.get-version.outputs.version }},enable=${{ github.event.pull_request.merged == true || contains(github.event.head_commit.message, 'build_image') }}
# - name: get-npm-version
# id: package-version
# uses: martinbeentjes/[email protected]

build-prod-image:
if: ${{ github.event.pull_request.merged }}
if: ${{ github.event.pull_request.merged == true }}
uses: ./.github/workflows/build-docker-image.yaml
needs: [metadata]
with:
Expand Down

0 comments on commit b8265c0

Please sign in to comment.