🔧 ci: Update workflow for PRs and latest Ubuntu versions (#2) #6
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: Ansible CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
distro: [ | |
ubuntu2004, ubuntu2204, ubuntu2404, | |
debian10, debian11, debian12, | |
rockylinux9, | |
] | |
steps: | |
- | |
uses: actions/checkout@v4 | |
- | |
name: Download test shim. | |
run: | | |
wget -O "${PWD}/tests/test-ansible-role.sh" https://raw.githubusercontent.com/esolitos/gists/master/shell/test-ansible-role.sh | |
chmod +x "${PWD}/tests/test-ansible-role.sh" | |
- | |
name: Run test | |
run: ${PWD}/tests/test-ansible-role.sh -d ${{ matrix.distro }} | |
publish: | |
# Run this job only if the push event is triggered on the default branch | |
if: github.event_name == 'push' && github.ref == ${{ github.event.repository.default_branch }} | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
env: | |
ansible-galaxy-key: ${{ secrets.ANSIBLE_GALAXY_KEY }} | |
steps: | |
- | |
uses: actions/checkout@v4 | |
- | |
name: Publish Ansible role to Galaxy | |
uses: robertdebock/[email protected] | |
with: | |
galaxy_api_key: ${{ env.ansible-galaxy-key }} |