feat(cosmos.testnet_services): command prefix #2
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: Tag Ansible Collection | |
on: | |
push: | |
paths: | |
- ansible_collections/*/galaxy.yml | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
create-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get modified collections info | |
id: collection | |
run: | | |
# Get list of modified galaxy.yml files in this commit | |
modified_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep 'ansible_collections/.*/galaxy\.yml' || true) | |
if [ -n "$modified_files" ]; then | |
while IFS= read -r file; do | |
if [ -f "$file" ]; then | |
collection_name=$(echo "$file" | cut -d'/' -f2) | |
version=$(grep "^version:" "$file" | cut -d' ' -f2) | |
echo "name=$collection_name" >> $GITHUB_OUTPUT | |
echo "version=$version" >> $GITHUB_OUTPUT | |
echo "Found modified collection: $collection_name version $version" | |
break | |
fi | |
done <<< "$modified_files" | |
else | |
echo "No galaxy.yml files modified in this commit" | |
exit 0 | |
fi | |
- name: Create tag | |
if: steps.collection.outputs.name != '' | |
run: | | |
tag_name="${{ steps.collection.outputs.name }}-${{ steps.collection.outputs.version }}" | |
if ! git tag | grep -q "^${tag_name}$"; then | |
git tag $tag_name | |
git push origin $tag_name | |
echo "Created and pushed tag: $tag_name" | |
else | |
echo "Tag $tag_name already exists, skipping" | |
fi |