Files

46 lines
1.5 KiB
YAML

---
name: Publish collection to Ansible Galaxy
on: # yamllint disable-line rule:truthy
release:
types:
- released
jobs:
deploy:
if: github.repository == 'dev-sec/ansible-collection-hardening'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
# deploy the collection first, because if it fails, we don't want
# to update the galaxy.yml
- name: Deploy the collection
uses: artis3n/ansible_galaxy_collection@ffbca2460a5a1c600b941bbf1536bd61de1c2227 # v3
with:
api_key: ${{ secrets.GALAXY_API_KEY }}
galaxy_version: ${{ github.event.release.tag_name }}
# checkout master instead of the release-tag so we can push the galaxy.yml
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: master
- name: update galaxy.yml with new version
uses: microsoft/variable-substitution@6287962da9e5b6e68778dc51e840caa03ca84495 # v1
with:
files: 'galaxy.yml'
env:
version: "${{ github.event.release.tag_name }}"
- name: push galaxy.yml
uses: github-actions-x/commit@722d56b8968bf00ced78407bbe2ead81062d8baa # v2.9
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
push-branch: 'master'
commit-message: 'update galaxy.yml with new version'
force-add: 'true'
files: galaxy.yml
name: dev-sec CI
email: [email protected]