-
Notifications
You must be signed in to change notification settings - Fork 13
43 lines (40 loc) · 1.26 KB
/
release_ah.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
name: Automation Hub Release
on:
workflow_call:
inputs:
ah_publish:
description: Publish the collection on automation hub
default: true
type: boolean
environment:
description: The deployment environment
required: true
type: string
secrets:
ah_token:
required: false
jobs:
release:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v4
- name: Build the collection
run: |
ansible-galaxy collection build -v --force
- name: Publish the collection on Automation Hub
if: ${{ inputs.ah_publish }}
run: |
[[ "${{ secrets.ah_token != '' }}" ]] || { echo "ah_token is required to publish on automation hub" ; exit 1; }
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}"
rm ansible.cfg