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>
pull/260/head
Sagar Paul 2023-05-11 16:36:23 +05:30 committed by GitHub
parent c2af5541ad
commit 5eaa5e3776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 0 deletions

2
.github/release-drafter.yml vendored Normal file
View File

@ -0,0 +1,2 @@
# see https://github.com/ansible-community/devtools
_extends: ansible-community/devtools

14
.github/workflows/ack.yml vendored Normal file
View File

@ -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

37
.github/workflows/release.yml vendored Normal file
View File

@ -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 }}