further changes to go module to only progress release if there are ch… #61
Workflow file for this run
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
name: Create/update tag | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
create-tag: | |
strategy: | |
matrix: | |
api_module: [ common,ledger,lostid,notification,ocr,partition,payment,profile,property,settings,files ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get latest tags | |
id: get_tags | |
run: | | |
# Get the two most recent tags | |
TAGS=$(git tag --sort=-creatordate | grep '^go/${{ matrix.api_module }}/v' | head -n 2) | |
echo $TAGS | |
TAG_ARRAY=($TAGS) | |
if [ ${#TAG_ARRAY[@]} -lt 2 ]; then | |
echo "Not enough tags found" | |
echo "::set-output name=not_enough_tags::true" | |
exit 0 | |
fi | |
echo "latest_tag=${TAG_ARRAY[0]}" >> $GITHUB_ENV | |
echo "previous_tag=${TAG_ARRAY[1]}" >> $GITHUB_ENV | |
echo "::set-output name=not_enough_tags::false" | |
- name: Set output if changes found | |
if: steps.get_tags.outputs.not_enough_tags == 'false' | |
id: go_module_changed | |
run: | | |
if [[ $(git diff --name-only ${{ env.previous_tag }} ${{ env.latest_tag }} | grep 'go/${{ matrix.api_module }}') ]]; then | |
echo "::set-output name=changed::true" | |
else | |
echo "::set-output name=changed::false" | |
fi | |
- uses: rickstaa/action-create-tag@v1 | |
if: steps.get_tags.outputs.not_enough_tags == 'true' || steps.go_module_changed.outputs.changed == 'true' | |
id: "tag_create" | |
with: | |
tag: go/${{ matrix.api_module }}/${{github.ref_name}} | |
tag_exists_error: false | |
message: "release module go/${{ matrix.api_module }}/${{github.ref_name}}" | |