Skip to content

Release

Release #12

Workflow file for this run

---
name: "Release"
on: # yamllint disable
release:
types: [published]
jobs:
lint:
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Install invoke"
run: "pip install -U pip && pip install invoke"
- name: "Linting"
run: "invoke lint"
unit:
runs-on: "ubuntu-22.04"
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
env:
INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER: "${{ matrix.python-version }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Install invoke"
run: "pip install -U pip && pip install invoke"
- name: "Tests"
run: "invoke unit"
needs:
- "lint"
integration:
uses: ./.github/workflows/integration_tests.yml
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
nautobot-version:
- "2.0"
- "2.1"
- "2.2"
- "2.3"
ansible-version:
- "2.16"
- "2.17"
with:
python-version: "${{ matrix.python-version }}"
nautobot-version: "${{ matrix.nautobot-version }}"
ansible-version: "${{ matrix.ansible-version }}"
needs:
- "unit"
publish_github:
name: "Publish to GitHub"
runs-on: "ubuntu-22.04"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.10"
- name: "Install Python Packages"
run: "pip install ansible-core"
- name: "Build the collection"
run: "ansible-galaxy collection build --output-path build"
- name: "Upload binaries to release"
uses: "svenstaro/upload-release-action@v2"
with:
repo_token: "${{ secrets.GH_NAUTOBOT_BOT_TOKEN }}"
file: "build/*"
tag: "${{ github.ref }}"
overwrite: true
file_glob: true
needs:
- "integration"
publish_galaxy:
name: "Publish to Ansible Galaxy"
runs-on: "ubuntu-22.04"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.10"
- name: "Install Python Packages"
run: "pip install ansible-core"
- name: "Create the ansible.cfg file"
run: |
cat << EOF > ansible.cfg
[galaxy]
server_list = published
[galaxy_server.published]
url=https://galaxy.ansible.com/api/
token=${{ secrets.GALAXY_API_TOKEN }}
EOF
shell: bash
- name: "Build the collection"
run: "ansible-galaxy collection build --output-path build"
- name: "Publish the collection"
run: "ansible-galaxy collection publish build/*"
needs:
- "integration"