From 5eaa5e37762a77f84e29f3e869fd57f419a4f17c Mon Sep 17 00:00:00 2001 From: Sagar Paul Date: Thu, 11 May 2023 16:36:23 +0530 Subject: [PATCH] enable release action (#257) * enable release * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/release-drafter.yml | 2 ++ .github/workflows/ack.yml | 14 +++++++++++++ .github/workflows/release.yml | 37 +++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/ack.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..114b5fc --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,2 @@ +# see https://github.com/ansible-community/devtools +_extends: ansible-community/devtools diff --git a/.github/workflows/ack.yml b/.github/workflows/ack.yml new file mode 100644 index 0000000..436af41 --- /dev/null +++ b/.github/workflows/ack.yml @@ -0,0 +1,14 @@ +# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/ack.yml +name: ack + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +on: + pull_request_target: + types: [opened, labeled, unlabeled, synchronize] + +jobs: + ack: + uses: ansible/devtools/.github/workflows/ack.yml@main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5fb4499 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +--- +name: Release the ansible collection +on: + release: + types: [published] + +jobs: + release_ah: + runs-on: ubuntu-latest + environment: ah + steps: + - uses: actions/checkout@v3 + + - name: "Publish collection on ah" + run: | + ansible-galaxy collection build -v --force + TARBALL=$(ls -1 ./*.tar.gz) + cat << EOF > ansible.cfg + [galaxy] + server_list = rh_automation_hub + [galaxy_server.rh_automation_hub] + url=https://cloud.redhat.com/api/automation-hub/ + auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token + token=${{ secrets.AH_TOKEN }} + EOF + ansible-galaxy collection publish "${TARBALL}" + + release_galaxy: + runs-on: ubuntu-latest + needs: release_ah + steps: + - uses: actions/checkout@v3 + + - name: "Publish collection on galaxy" + uses: ansible/ansible-publish-action@v1.0.0 + with: + api_key: ${{ secrets.ANSIBLE_GALAXY_API_KEY }}