Skip to content

Commit 5fa2185

Browse files
authored
Merge pull request #12 from kbase/develop
Adding release workflow.
2 parents d9eb519 + 866babc commit 5fa2185

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

.github/workflows/release-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Release - Test, Build & Push Image
2+
name: Release - Build & Push Image
33
on:
44
release:
55
branches:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Release2 - Build & Push Image
3+
on:
4+
release:
5+
branches:
6+
- main
7+
- master
8+
types: [ published ]
9+
jobs:
10+
check-source-branch:
11+
if: github.event.release.target_commitish != 'master' && github.event.release.target_commitish != 'main'
12+
uses: .github/workflows/reusable_validate-branch.yml
13+
with:
14+
build_branch: '${{ github.event.release.target_commitish }}'
15+
validate-release-tag:
16+
uses: kbase/.github/.github/workflows/reusable_validate-release-tag.yml@main
17+
with:
18+
release_tag: '${{ github.event.release.tag_name }}'
19+
build-push:
20+
needs: validate-release-tag
21+
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main
22+
with:
23+
name: '${{ github.event.repository.name }}'
24+
tags: '${{ github.event.release.tag_name }},latest'
25+
secrets: inherit
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Ensure releases are build from main/master branch.
3+
on:
4+
workflow_call:
5+
inputs:
6+
build_branch:
7+
required: true
8+
type: string
9+
jobs:
10+
ensure-semver:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Validate that releases are build from main/master
14+
uses: actions/github-script@v6
15+
with:
16+
script: |
17+
const buildBranch = '${{ inputs.build_branch }}';
18+
if ((buildBranch !== 'main') && ((buildBranch !== 'master')) {
19+
core.setFailed(`Releases must be built from the main or master branch, not "${buildBranch}"`)
20+
}

0 commit comments

Comments
 (0)