1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

Fix publish job (#89)

Add dry run job for testing publishing
This commit is contained in:
Sergey 2020-07-22 13:06:07 +03:00 committed by GitHub
parent 869c644448
commit e1a81db9ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 11 deletions

View file

@ -0,0 +1,58 @@
name: Collection release and publish DRY RUN
on:
push:
paths:
- '.github/workflows/collection-publish.yml'
- '.github/workflows/collection-publish-dry-run.yml'
- 'contrib/build.py'
- 'contrib/publish-requirements.txt'
- 'contrib/publish.sh'
branches:
- master
pull_request:
paths:
- '.github/workflows/collection-publish.yml'
- '.github/workflows/collection-publish-dry-run.yml'
- 'contrib/build.py'
- 'contrib/publish-requirements.txt'
- 'contrib/publish.sh'
schedule:
- cron: 3 0 * * * # Run daily at 0:03 UTC
jobs:
publish-collection-artifact-dry-run:
name: Publish
runs-on: ${{ matrix.runner-os }}
strategy:
matrix:
runner-os:
- ubuntu-16.04
ansible-version:
- git+https://github.com/ansible/ansible.git@stable-2.10
runner-python-version:
- 3.7
steps:
- name: Check out ${{ github.repository }} on disk
uses: actions/checkout@master
- name: Set up Python ${{ matrix.runner-python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.runner-python-version }}
- name: Install Ansible ${{ matrix.ansible-version }}
run: |
python -m pip install virtualenv
python -m virtualenv /tmp/new-ansible
/tmp/new-ansible/bin/pip install '${{ matrix.ansible-version }}'
/tmp/new-ansible/bin/pip install -r contrib/publish-requirements.txt
- name: Generate a version from tag
run: >-
./contrib/publish.sh ${GITHUB_REF##*/}
env:
API_GALAXY_TOKEN: noreallykeyhere
GALAXY_PATH: /tmp/new-ansible/bin/ansible-galaxy
PYTHON_PATH: /tmp/new-ansible/bin/python
DRYRUN: 1

View file

@ -28,10 +28,10 @@ jobs:
- name: Install Ansible ${{ matrix.ansible-version }}
run: |
python -m pip install --user -r contrib/publish-requirements.txt
python -m pip install --user -U --force '${{ matrix.ansible-version }}'
python -m pip install virtualenv
python -m virtualenv /tmp/new-ansible
/tmp/new-ansible/bin/pip install '${{ matrix.ansible-version }}'
/tmp/new-ansible/bin/pip install -r contrib/publish-requirements.txt
- name: Generate a version from tag
run: >-
@ -39,3 +39,5 @@ jobs:
env:
API_GALAXY_TOKEN: ${{ secrets.API_GALAXY_TOKEN }}
GALAXY_PATH: /tmp/new-ansible/bin/ansible-galaxy
PYTHON_PATH: /tmp/new-ansible/bin/python
DRYRUN: 0

View file

@ -1,3 +1,2 @@
PyYAML
galaxy-importer
virtualenv
#galaxy-importer

View file

@ -10,7 +10,7 @@ ANSIBLE_GALAXY_BIN=${GALAXY_PATH:-'ansible-galaxy'}
echo "Start building collection"
echo "Generating galaxy.yml for version $1"
./contrib/build.py "$1"
${PYTHON_PATH:-python} ./contrib/build.py "$1"
rm -rf build_artifact
mkdir -p build_artifact
@ -20,11 +20,15 @@ COLLECTION_P=$(ls build_artifact/*tar.gz)
echo "Publishing collection $COLLECTION_P"
output=$(python -m galaxy_importer.main $COLLECTION_P)
if echo $output | grep ERROR: ; then
echo "Failed check of galaxy importer!"
exit 1
fi
# output=$(${PYTHON_PATH:-python} -m galaxy_importer.main $COLLECTION_P)
# if echo $output | grep ERROR: ; then
# echo "Failed check of galaxy importer!"
# exit 1
# fi
echo "Running: ${ANSIBLE_GALAXY_BIN} collection publish --api-key HIDDEN $COLLECTION_P"
if [[ "${DRYRUN:-0}" == "1" ]]; then
${ANSIBLE_GALAXY_BIN} collection publish --api-key testkey $COLLECTION_P || true
else
${ANSIBLE_GALAXY_BIN} collection publish --api-key $API_GALAXY_TOKEN $COLLECTION_P
fi