diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index 1f8d455..9269beb 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -3,11 +3,15 @@ # Ansible managed # -name: Release to Ansible Galaxy +name: Ansible Galaxy +# Only release to ansible galaxy if semantic release was successful on: - release: - types: [created, edited, published, released] + workflow_run: + workflows: [Semantic release] + types: + - completed + jobs: release: runs-on: ubuntu-20.04 @@ -16,3 +20,4 @@ jobs: uses: robertdebock/galaxy-action@1.2.1 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} + git_branch: main diff --git a/.github/workflows/go-semantic-release.yml b/.github/workflows/go-semantic-release.yml index 16abba1..77c86cd 100644 --- a/.github/workflows/go-semantic-release.yml +++ b/.github/workflows/go-semantic-release.yml @@ -3,12 +3,16 @@ # Ansible managed # -name: Create a semantic release on push to main +name: Semantic release + +# Only release if molecule works and on main branch on: - push: - branches: - - "main" + workflow_run: + workflows: [Molecule] + branches: [main] + types: + - completed # If a 403 error occurs, make sure to set content permission to write # see: https://github.com/go-semantic-release/action/issues/27 @@ -20,7 +24,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: go-semantic-release/action@v1 + - name: go-semantic-release + uses: go-semantic-release/action@v1 id: semrel with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index 64d521a..1e015ba 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -3,7 +3,7 @@ # Ansible managed # -name: Ansible Molecule +name: Molecule on: push: diff --git a/README.md b/README.md index 89b0c5c..3c59b04 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Installs and configures Docker. |GitHub|Downloads|Version| |------|---------|-------| -|[![github](https://github.com/mullholland/ansible-role-docker/actions/workflows/molecule.yml/badge.svg)](https://github.com/mullholland/ansible-role-docker/actions/workflows/molecule.yml)|[![downloads](https://img.shields.io/ansible/role/d/)](https://galaxy.ansible.com/mullholland/docker)|[![Version](https://img.shields.io/github/release/mullholland/ansible-role-docker.svg)](https://github.com/mullholland/ansible-role-docker/releases/)| +|[![github](https://github.com/mullholland/ansible-role-docker/actions/workflows/molecule.yml/badge.svg)](https://github.com/mullholland/ansible-role-docker/actions/workflows/molecule.yml)|[![downloads](https://img.shields.io/ansible/role/d/mullholland/docker)](https://galaxy.ansible.com/mullholland/docker)|[![Version](https://img.shields.io/github/release/mullholland/ansible-role-docker.svg)](https://github.com/mullholland/ansible-role-docker/releases/)| ## [Example Playbook](#example-playbook) This example is taken from [`molecule/default/converge.yml`](https://github.com/mullholland/ansible-role-docker/blob/master/molecule/default/converge.yml) and is tested on each push, pull request and release.