mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-03 23:01:48 +00:00
Add build script (#58)
This commit is contained in:
parent
8b717f9201
commit
3330f840c0
6 changed files with 120 additions and 0 deletions
41
.github/workflows/collection-publish.yml
vendored
Normal file
41
.github/workflows/collection-publish.yml
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
name: Collection release and publish
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '[0-9]+\.[0-9]+\.[0-9]+'
|
||||
|
||||
jobs:
|
||||
publish-collection-artifact:
|
||||
name: Publish
|
||||
runs-on: ${{ matrix.runner-os }}
|
||||
strategy:
|
||||
matrix:
|
||||
runner-os:
|
||||
- ubuntu-16.04
|
||||
ansible-version:
|
||||
- git+https://github.com/ansible/ansible.git@devel
|
||||
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 --user -r contrib/publish-requirements.txt
|
||||
python -m pip install --user -U --force '${{ matrix.ansible-version }}'
|
||||
python -m virtualenv /tmp/new-ansible
|
||||
/tmp/new-ansible/bin/pip install '${{ matrix.ansible-version }}'
|
||||
|
||||
- name: Generate a version from tag
|
||||
run: >-
|
||||
./contrib/publish.sh ${GITHUB_REF##*/}
|
||||
env:
|
||||
API_GALAXY_TOKEN: ${{ secrets.API_GALAXY_TOKEN }}
|
||||
GALAXY_PATH: /tmp/new-ansible/bin/ansible-galaxy
|
||||
14
contrib/build.py
Executable file
14
contrib/build.py
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("No version was provided!")
|
||||
sys.exit(1)
|
||||
|
||||
version = sys.argv[1]
|
||||
with open("galaxy.yml.in") as f:
|
||||
y = yaml.safe_load(f)
|
||||
y['version'] = version
|
||||
with open("galaxy.yml", "w") as ff:
|
||||
yaml.safe_dump(y, ff)
|
||||
3
contrib/publish-requirements.txt
Normal file
3
contrib/publish-requirements.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
PyYAML
|
||||
galaxy-importer
|
||||
virtualenv
|
||||
30
contrib/publish.sh
Executable file
30
contrib/publish.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "Please provide a tag!"
|
||||
exit 1
|
||||
fi
|
||||
ANSIBLE_GALAXY_BIN=${GALAXY_PATH:-'ansible-galaxy'}
|
||||
|
||||
echo "Start building collection"
|
||||
echo "Generating galaxy.yml for version $1"
|
||||
./contrib/build.py "$1"
|
||||
|
||||
rm -rf build_artifact
|
||||
mkdir -p build_artifact
|
||||
|
||||
${ANSIBLE_GALAXY_BIN} collection build --force --output-path build_artifact/
|
||||
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
|
||||
|
||||
echo "Running: ${ANSIBLE_GALAXY_BIN} collection publish --api-key HIDDEN $COLLECTION_P"
|
||||
${ANSIBLE_GALAXY_BIN} collection publish --api-key $API_GALAXY_TOKEN $COLLECTION_P
|
||||
|
|
@ -27,3 +27,5 @@ build_ignore:
|
|||
- ".idea"
|
||||
- ".github"
|
||||
- contrib
|
||||
- galaxy.yml.in
|
||||
- importer_result.json
|
||||
|
|
|
|||
30
galaxy.yml.in
Normal file
30
galaxy.yml.in
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
namespace: containers
|
||||
name: podman
|
||||
# version:
|
||||
readme: README.md
|
||||
authors:
|
||||
- Sagi Shnaidman <sshnaidm@redhat.com>
|
||||
- Ansible team
|
||||
description: Podman container Ansible modules
|
||||
license: GPL-3.0-or-later
|
||||
tags:
|
||||
- containers
|
||||
- podman
|
||||
- libpod
|
||||
dependencies: {}
|
||||
repository: https://github.com/containers/ansible-podman-collections.git
|
||||
documentation: https://github.com/containers/ansible-podman-collections
|
||||
homepage: https://github.com/containers/ansible-podman-collections
|
||||
issues: https://github.com/containers/ansible-podman-collections/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc
|
||||
build_ignore:
|
||||
- ci
|
||||
- tests/output
|
||||
- build_artifact
|
||||
- "*.tar.gz"
|
||||
- ".gitignore"
|
||||
- ".history"
|
||||
- ".vscode"
|
||||
- ".idea"
|
||||
- ".github"
|
||||
- contrib
|
||||
- importer_result.json
|
||||
Loading…
Add table
Add a link
Reference in a new issue