Skip to content

Commit 9098de3

Browse files
sutaakaranishasthana
authored andcommitted
Add support for GitHub action release from any branch
1 parent ece7e26 commit 9098de3

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

.github/workflows/instascale-release.yml

+21-11
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ on:
66
workflow_dispatch:
77
inputs:
88
tag:
9-
description: 'Release tag'
9+
description: 'Release tag (for example: v0.0.0)'
1010
required: true
11-
default: 'v0.0.0-dev'
1211
mcad-version:
13-
description: 'Published version of multi-cluster-app-dispatcher to be used as a dependency for InstaScale'
12+
description: 'Published version of multi-cluster-app-dispatcher to be used as a dependency for InstaScale (for example: v0.0.0)'
1413
required: true
15-
default: 'v0.0.0-dev'
16-
is-latest:
17-
description: 'Select if the built image should be tagged as latest'
14+
is-stable:
15+
description: 'Select if the built image should be tagged as stable'
1816
required: true
1917
type: boolean
2018
quay-organization:
@@ -33,6 +31,18 @@ jobs:
3331
steps:
3432
- uses: actions/checkout@v3
3533

34+
- name: Verify that release doesn't exist yet
35+
shell: bash {0}
36+
run: |
37+
gh release view ${{ github.event.inputs.tag }}
38+
status=$?
39+
if [[ $status -eq 0 ]]; then
40+
echo "Release ${{ github.event.inputs.tag }} already exists."
41+
exit 1
42+
fi
43+
env:
44+
GITHUB_TOKEN: ${{ github.TOKEN }}
45+
3646
- name: Set up Go
3747
uses: actions/setup-go@v3
3848
with:
@@ -59,11 +69,11 @@ jobs:
5969
run: |
6070
make image-build -e IMG=quay.io/${{ github.event.inputs.quay-organization }}/instascale-controller:${{ github.event.inputs.tag }}
6171
make image-push -e IMG=quay.io/${{ github.event.inputs.quay-organization }}/instascale-controller:${{ github.event.inputs.tag }}
62-
- name: Image Push as latest tag
63-
if: ${{ inputs.is-latest }}
72+
- name: Image Push as stable tag
73+
if: ${{ inputs.is-stable }}
6474
run: |
65-
podman tag quay.io/${{ github.event.inputs.quay-organization }}/instascale-controller:${{ github.event.inputs.tag }} quay.io/${{ github.event.inputs.quay-organization }}/instascale-controller:latest
66-
make image-push -e IMG=quay.io/${{ github.event.inputs.quay-organization }}/instascale-controller:latest
75+
podman tag quay.io/${{ github.event.inputs.quay-organization }}/instascale-controller:${{ github.event.inputs.tag }} quay.io/${{ github.event.inputs.quay-organization }}/instascale-controller:stable
76+
make image-push -e IMG=quay.io/${{ github.event.inputs.quay-organization }}/instascale-controller:stable
6777
6878
# Update dependencies
6979
- name: Commit go.mod and go.sum changes back to repository
@@ -75,7 +85,7 @@ jobs:
7585
# Create a release in InstaScale
7686
- name: Creates a release in GitHub
7787
run: |
78-
gh release create ${{ github.event.inputs.tag }} --generate-notes
88+
gh release create ${{ github.event.inputs.tag }} --target ${{ github.ref }} --generate-notes
7989
env:
8090
GITHUB_TOKEN: ${{ github.TOKEN }}
8191
shell: bash

0 commit comments

Comments
 (0)