-
Notifications
You must be signed in to change notification settings - Fork 34
113 lines (112 loc) · 3.15 KB
/
trigger_release.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
name: "Release"
on: # yamllint disable
release:
types: [published]
jobs:
lint:
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v3"
- 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.9"
- "3.10"
- "3.11"
env:
INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER: "${{ matrix.python-version }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v3"
- 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.9"
- "3.10"
- "3.11"
nautobot-version:
- "2.0"
- "2.1"
# TODO: Enable 2.2 once it's released
# - "2.2"
ansible-version:
- "2.14"
- "2.15"
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@v3"
- name: "Set up Python"
uses: "actions/setup-python@v3"
with:
python-version: "3.9"
- 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@v3"
- name: "Set up Python"
uses: "actions/setup-python@v3"
with:
python-version: "3.9"
- 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"