diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..8f9f513 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ + +name: Publish +on: + release: + types: [created] + +jobs: + publish: + name: Publish to galaxy + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install ansible-base + run: pip install ansible-base + + - name: Update the galaxy.yml with the release + env: + VERSION: ${{ github.event.release.tag_name }} + run: | + sed 's/{{ version }}/'$VERSION'/' galaxy.yml + cat galaxy.yml + + # - name: Build and publish + # env: + # ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} + # run: | + # ansible-galaxy collection build + # ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY diff --git a/galaxy.yml b/galaxy.yml index 24a96ad..0b8f8bf 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -8,6 +8,5 @@ description: Ansible Collection with utilities to ease the management, manipulat readme: README.md repository: https://github.com/ansible-collections/ansible.utils tags: [networking, security, cloud, utilities, data, validation] -# NOTE(pabelanger): We create an empty version key to keep ansible-galaxy -# happy. We dynamically inject version info based on git information. -version: null +# this will be updated by a gh action prior to push +version: {{ version }}