-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Build image | ||
name: Determine and create tag | ||
|
||
on: | ||
pull_request: | ||
|
@@ -8,18 +8,46 @@ env: | |
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-image: | ||
determine-create-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get latest tag | ||
id: get-latest-tag | ||
shell: bash | ||
run: | | ||
latest=$(git describe --abbrev=0 --tags || echo "v0.0.0") | ||
echo "LATEST_TAG=latest" >> "$GITHUB_OUTPUT" | ||
tag=$(git describe --abbrev=0 --tags) | ||
if [ "$?" -ne "0" ] | ||
then | ||
tag="v0.0.0" | ||
fi | ||
echo "tag=$latest" >> "$GITHUB_OUTPUT" | ||
- name: Get PR labels | ||
id: pr-labels | ||
uses: joerick/[email protected] | ||
- if: contains(steps.pr-labels.outputs.labels, 'new patch release') | ||
run: echo '### New version 🚀\n When merging, version xyz will be created' >> $GITHUB_STEP_SUMMARY | ||
|
||
- name: Get semver bump level | ||
id: get-semver-level | ||
run: | | ||
level="patch" | ||
all_labels=(${{ steps.pr-labels.outputs.labels }}) | ||
if [[ ${all_labels[@]} =~ "new minor release" ]] | ||
then | ||
level="minor" | ||
elif [[ ${all_labels[@]} =~ "new major release" ]] | ||
then | ||
level="major" | ||
fi | ||
echo "level=$level" >> "$GITHUB_OUTPUT" | ||
- uses: actions-ecosystem/action-bump-semver@v1 | ||
id: bump-semver | ||
with: | ||
current_version: ${{ steps.get-latest-tag.outputs.tag }} | ||
level: ${{ steps.get-semver-level.outputs.level }} | ||
|
||
- name: Print summary | ||
run: echo '### New version 🚀\n When merging, version ${{ steps.bump-semver.outputs.new_version }} will be created' >> $GITHUB_STEP_SUMMARY |