mirror of
https://github.com/kewlfft/ansible-aur.git
synced 2025-09-17 00:20:38 +03:00
42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
YAML
name: Build and Publish Collection to Ansible Galaxy
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: collections/ansible_collections/kewlfft/aur
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v5
|
|
with:
|
|
path: collections/ansible_collections/kewlfft/aur
|
|
|
|
- name: Verify version in galaxy.yml matches release tag
|
|
id: version
|
|
run: |
|
|
tag_version="${GITHUB_REF##*/}" # strip refs/tags/
|
|
file_version=$(awk '/^version:/ {print $2}' galaxy.yml)
|
|
|
|
if [ "$file_version" != "$tag_version" ]; then
|
|
echo "❌ galaxy.yml version ($file_version) does not match tag ($tag_version)"
|
|
exit 1
|
|
fi
|
|
|
|
echo "version=$tag_version" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Build collection
|
|
run: ansible-galaxy collection build
|
|
|
|
- name: Publish collection
|
|
run: |
|
|
tarball="kewlfft-aur-${{ steps.version.outputs.version }}.tar.gz"
|
|
ansible-galaxy collection publish "$tarball" \
|
|
--api-key "${{ secrets.ANSIBLE_GALAXY_API_KEY }}"
|