mirror of
https://github.com/ansible-collections/community.routeros.git
synced 2025-08-05 18:54:51 +02:00
83 lines
2.4 KiB
YAML
83 lines
2.4 KiB
YAML
name: import-galaxy
|
|
on:
|
|
# Run CI against all pushes (direct commits, also merged PRs) to main, and all Pull Requests
|
|
push:
|
|
branches:
|
|
- main
|
|
- stable-*
|
|
pull_request:
|
|
|
|
env:
|
|
# Adjust this to your collection
|
|
NAMESPACE: community
|
|
COLLECTION_NAME: routeros
|
|
|
|
jobs:
|
|
build-collection:
|
|
name: Build collection artifact
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
path: ./checkout
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v3
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Install ansible-core
|
|
run: pip install https://github.com/ansible/ansible/archive/stable-2.12.tar.gz --disable-pip-version-check
|
|
|
|
- name: Make sure galaxy.yml has version entry
|
|
run: >-
|
|
python -c
|
|
'import yaml ;
|
|
f = open("galaxy.yml", "rb") ;
|
|
data = yaml.safe_load(f) ;
|
|
f.close() ;
|
|
data["version"] = data.get("version") or "0.0.1" ;
|
|
f = open("galaxy.yml", "wb") ;
|
|
f.write(yaml.dump(data).encode("utf-8")) ;
|
|
f.close() ;
|
|
'
|
|
working-directory: ./checkout
|
|
|
|
- name: Build collection
|
|
run: ansible-galaxy collection build
|
|
working-directory: ./checkout
|
|
|
|
- name: Copy artifact into subdirectory
|
|
run: mkdir ./artifact && mv ./checkout/${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}-*.tar.gz ./artifact
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}-${{ github.sha }}
|
|
path: ./artifact/
|
|
|
|
import-galaxy:
|
|
name: Import artifact with Galaxy importer
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build-collection
|
|
steps:
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v3
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Install ansible-core
|
|
run: pip install https://github.com/ansible/ansible/archive/stable-2.12.tar.gz --disable-pip-version-check
|
|
|
|
- name: Install galaxy-importer
|
|
run: pip install galaxy-importer --disable-pip-version-check
|
|
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: ${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}-${{ github.sha }}
|
|
|
|
- name: Run Galaxy importer
|
|
run: python -m galaxy_importer.main ${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}-*.tar.gz
|