-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (49 loc) · 1.99 KB
/
galaxy-importer.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Its role is to performe the same checks that would be performed when publishing to galaxy
# Running them earlier helps to detect issues locally
name: galaxy-importer
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches:
- main
jobs:
galaxy-importer:
runs-on:
- ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Get collection namespace and name from galaxy.yml
id: collection-name
run: |
NAMESPACE=$(grep '^namespace:' galaxy.yml | awk '{print $2}' | tr -d "'\"")
NAME=$(grep '^name:' galaxy.yml | awk '{print $2}' | tr -d "'\"")
VERSION=$(grep '^version:' galaxy.yml | awk '{print $2}' | tr -d "'\"")
if [[ -z "$NAMESPACE" || -z "$NAME" || -z "$VERSION" ]]; then
echo "Error: Unable to find or parse namespace, name, or version in galaxy.yml"
exit 1
fi
echo "Collection namespace is $NAMESPACE"
echo "Collection name is $NAME"
echo "Collection version is $VERSION"
echo "COLLECTION_NAMESPACE=$NAMESPACE" >> $GITHUB_ENV
echo "COLLECTION_NAME=$NAME" >> $GITHUB_ENV
echo "COLLECTION_VERSION=$VERSION" >> $GITHUB_ENV
- name: Install Ansible and importer
run: |
pip install ansible==9.4.0
pip install ansible-importer
pip install galaxy-importer
- name: Build and install the collection
run: |
ansible-galaxy collection build $GITHUB_WORKSPACE --force
ansible-galaxy collection install $GITHUB_WORKSPACE/$COLLECTION_NAMESPACE-$COLLECTION_NAME-$COLLECTION_VERSION.tar.gz
- name: Run ac-galaxy-importer
run: |
python -m galaxy_importer.main $GITHUB_WORKSPACE/$COLLECTION_NAMESPACE-$COLLECTION_NAME-$COLLECTION_VERSION.tar.gz