Skip to content

Commit 8819ec1

Browse files
authored
Merge pull request #9277 from opencrvs/provide-branch-to-build
build: provide branch as build arg
2 parents 7b51f3d + 94c7a3b commit 8819ec1

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/publish-release.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ name: Publish release
1111
on:
1212
workflow_dispatch:
1313
inputs:
14-
branch_name:
15-
description: Branch to build from
16-
default: develop
17-
required: true
14+
# release_version:
15+
# This input parameter specifies the release version number for the workflow.
16+
# Value is used to checkout the correct branch or tag
1817
release_version:
1918
description: Release version number
2019
required: true
@@ -34,16 +33,18 @@ jobs:
3433
- uses: actions/checkout@v4
3534
if: github.event_name == 'workflow_dispatch'
3635
with:
37-
ref: '${{ github.event.inputs.branch_name }}'
36+
ref: '${{ github.event.inputs.release_version }}'
3837

3938
- uses: actions/checkout@v4
4039
if: github.event_name == 'push'
4140

42-
- name: Set version
43-
id: set-version
41+
- name: Set version and branch
42+
id: set-version-and-branch
4443
run: |
4544
export VERSION=${{ github.event.inputs.release_version }}
4645
echo "version=$VERSION" >> $GITHUB_OUTPUT
46+
export BRANCH=${{ github.event.inputs.release_version }}
47+
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
4748
4849
- name: Get list of services
4950
id: get-services
@@ -67,13 +68,14 @@ jobs:
6768
context: .
6869
push: true
6970
tags: |
70-
opencrvs/ocrvs-base:${{ steps.set-version.outputs.version }}
71-
cache-from: type=registry,ref=opencrvs/ocrvs-base:${{ steps.set-version.outputs.version }}
71+
opencrvs/ocrvs-base:${{ steps.set-version-and-branch.outputs.version }}
72+
cache-from: type=registry,ref=opencrvs/ocrvs-base:${{ steps.set-version-and-branch.outputs.version }}
7273
cache-to: type=inline
7374

7475
outputs:
7576
services: ${{ steps.get-services.outputs.services }}
76-
version: ${{ steps.set-version.outputs.version }}
77+
version: ${{ steps.set-version-and-branch.outputs.version }}
78+
branch: ${{ steps.set-version-and-branch.outputs.branch }}
7779

7880
build:
7981
needs: base
@@ -86,7 +88,7 @@ jobs:
8688
- uses: actions/checkout@v4
8789
if: github.event_name == 'workflow_dispatch'
8890
with:
89-
ref: '${{ github.event.inputs.branch_name }}'
91+
ref: '${{ github.event.inputs.release_version }}'
9092

9193
- uses: actions/checkout@v4
9294
if: github.event_name == 'push'
@@ -103,6 +105,7 @@ jobs:
103105
file: packages/${{ matrix.service }}/Dockerfile
104106
build-args: |
105107
VERSION=${{ needs.base.outputs.version }}
108+
BRANCH=${{ needs.base.outputs.branch }}
106109
push: true
107110
context: .
108111
tags: |

0 commit comments

Comments
 (0)