test golang release of only one module #62
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 1) | |
echo $TAGS | |
TAG_ARRAY=($TAGS) | |
if [ ${#TAG_ARRAY[@]} -lt 1 ]; then | |
echo "Not enough tags found" | |
echo "not_enough_tags=true" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
echo "latest_tag=${TAG_ARRAY[0]}" >> $GITHUB_ENV | |
echo "not_enough_tags=false" >> $GITHUB_OUTPUT | |
- 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.latest_tag }} HEAD | grep 'go/${{ matrix.api_module }}') ]]; then | |
echo "changed=true" >> $GITHUB_OUTPUT | |
else | |
echo "changed=false" >> $GITHUB_OUTPUT | |
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}}" | |