forked from paritytech/ansible-polkadot
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (38 loc) · 1.33 KB
/
reusable-galaxy-deploy.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
on:
workflow_call:
inputs:
ansible-version:
required: false
type: string
default: 9.0.1
secrets:
api-token:
required: true
jobs:
deploy-galaxy:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: "${{ github.repository }}"
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Setup Python modules
run: pip3 install --no-cache-dir ansible==${{ inputs.ansible-version }} yq
- name: Print Ansible version
run: ansible --version
- name: Build collection
run: ansible-galaxy collection build "${{ github.repository }}"
- name: Save API token
run: echo '${{ secrets.api-token }}' > api-token
- name: Publish collection
run: |
GALAXY_NAMESPACE=$(cat ${GITHUB_REPOSITORY}/galaxy.yml | yq -r '.namespace' | tr -d '\n')
GALAXY_NAME=$(cat ${GITHUB_REPOSITORY}/galaxy.yml | yq -r '.name' | tr -d '\n')
VERSION=$(cat ${GITHUB_REPOSITORY}/galaxy.yml | yq -r '.version' | tr -d '\n')
ansible-galaxy collection publish ${GALAXY_NAMESPACE}-${GALAXY_NAME}-${VERSION}.tar.gz --api-key="$(cat api-token | tr -d '\n')"
- name: Remove API token
run: rm -v api-token