From 146416eddf0da9ece16215a775c6791c6e1a3b21 Mon Sep 17 00:00:00 2001 From: Falk Scheerschmidt Date: Fri, 24 Jun 2022 15:58:17 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Extract=20Ansible=20Galaxy=20Releas?= =?UTF-8?q?e=20from=20Integration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/ansible-galaxy-workflow.yaml | 19 +++++++++ .../ansible-integration-workflow.yaml | 20 ---------- README.md | 39 +++++++++++++++++-- 3 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/ansible-galaxy-workflow.yaml diff --git a/.github/workflows/ansible-galaxy-workflow.yaml b/.github/workflows/ansible-galaxy-workflow.yaml new file mode 100644 index 0000000..ba6c81c --- /dev/null +++ b/.github/workflows/ansible-galaxy-workflow.yaml @@ -0,0 +1,19 @@ +--- +name: Ansible Galaxy + +on: + workflow_call: + secrets: + galaxy-token: + required: true + description: "Token to upload the Role to Ansible Galaxy" + +jobs: + publish: + name: Publish Role + runs-on: ubuntu-20.04 + steps: + - name: Publish to Ansible Galaxy + uses: robertdebock/galaxy-action@1.2.0 + with: + galaxy_api_key: ${{ secrets.galaxy-token }} diff --git a/.github/workflows/ansible-integration-workflow.yaml b/.github/workflows/ansible-integration-workflow.yaml index 41e3323..26f6adb 100644 --- a/.github/workflows/ansible-integration-workflow.yaml +++ b/.github/workflows/ansible-integration-workflow.yaml @@ -9,11 +9,6 @@ on: description: "List of distributions to test against the Role" type: string default: '[ "debian11", "debian10" ]' - default-branch: - required: false - description: "Default branch of the repository. Default: main" - type: string - default: "main" python-dependencies: required: false description: "Default pip dependencies for molecule" @@ -52,10 +47,6 @@ on: description: "Disable AppArmor MySQL Profile for the Job Runner" type: boolean default: false - secrets: - galaxy-token: - required: true - description: "Token to upload the Role to Ansible Galaxy" jobs: lint: @@ -137,14 +128,3 @@ jobs: PY_COLORS: "1" ANSIBLE_FORCE_COLOR: "1" MOLECULE_DISTRO: ${{ matrix.distro }} - - release: - name: Ansible Galaxy - runs-on: ubuntu-20.04 - needs: [test] - if: github.ref_name == inputs.default-branch || contains(github.ref, 'refs/tags/') - steps: - - name: Publish to Ansible Galaxy - uses: robertdebock/galaxy-action@1.2.0 - with: - galaxy_api_key: ${{ secrets.galaxy-token }} diff --git a/README.md b/README.md index ead16ea..c831f24 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,18 @@ -# Github Workflow for Ansible Roles +# Github Workflows for Ansible Roles -## Configuration +## Continuous Integration (Molecule) + +### Configuration | Variable | Type | Default | Description | |---|---|---|---| | distros | string | '[ "debian11", "debian10" ]' | List of distributions to test against the Role | -| default-branch | string | main | Default branch of the repository| | python-dependencies | string | [see workflow](.github/workflows/ansible-integration-workflow.yaml) | Default pip dependencies for molecule | | role-dependencies | string | [see workflow](.github/workflows/ansible-integration-workflow.yaml) | Default role dependencies for ansible (empty)| | molecule-config | string | [see workflow](.github/workflows/ansible-integration-workflow.yaml) | Configuration for molecule | | disable-apparmor-mysql | boolean | false | Disable AppArmor MySQL Profile for the Job Runner | -## Usage +### Usage Create a workflow, e.g. `.github/workflows/integration.yaml` @@ -34,3 +35,33 @@ jobs: secrets: galaxy-token: ${{ secrets.galaxy_api_key }} ``` + +## Ansible Galaxy + +### Configuration + +| Variable | Type | Default | Description | +|---|---|---|---| +| galaxy-token | secret | | Secret for Ansible Galaxy | + +### Usage + +Create a workflow, e.g. `.github/workflows/galaxy.yaml` + +```yaml +--- +name: Ansible Galaxy + +on: + push: + branches: + - main + release: + +jobs: + galaxy: + name: Ansible Galaxy + uses: systemli/github-ansible-workflow/.github/workflows/ansible-galaxy-workflow.yaml@main + secrets: + galaxy-token: ${{ secrets.galaxy_api_key }} +```