-
Notifications
You must be signed in to change notification settings - Fork 8
82 lines (73 loc) · 2.7 KB
/
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
---
name: Release and Publish
on:
push:
tags:
- "v*.*.*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup python 🐍
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies 👽
run: python -m pip install ansible-core yq rst-to-myst
- name: Verify release 🗒️
env:
TAG_NAME: ${{ github.ref_name }}
run: |
echo "::warning::TODO: confirm tests pass for this commit"
tag_version="${TAG_NAME##*v}"
version="$(yq -r .version galaxy.yml)"
if [[ ${tag_version} != ${version} ]]; then
echo "::error file=galaxy.yml::🔴 Tag version '${tag_version}' does not match galaxy.yml version '${version}'"
exit 1
fi
echo "::notice::🟢 Version number verified: '$version'"
- name: Build 🛠️
run: ansible-galaxy collection build -v --force .
- name: Prepare release notes 📓
env:
CHANGELOG_URL: "${{ format('{0}/{1}/blob/{2}/CHANGELOG.rst', github.server_url, github.repository, github.ref_name) }}"
REF_NAME: "${{ github.ref_name }}"
run: |
rst2myst stream --no-sphinx CHANGELOG.rst | csplit - "/^## ${REF_NAME}/" '/^## v.*/'
mv xx01 release_notes.md
echo "See also: [CHANGELOG](${CHANGELOG_URL}#${REF_NAME//./-})" >>release_notes.md
- name: Release 🛸
uses: softprops/action-gh-release@v2
with:
files: |
*.tar.gz
body_path: release_notes.md
fail_on_unmatched_files: true
generate_release_notes: true
publish-to-galaxy:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish to Ansible Galaxy 🌌
uses: ansible/[email protected]
with:
api_key: ${{ secrets.GALAXY_API_KEY }}
publish-to-automation-platform:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish to Ansible Automation Platform 🌌
uses: ansible/[email protected]
env:
ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_URL: https://console.redhat.com/api/automation-hub/
ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_AUTH_URL: https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
ANSIBLE_GALAXY_SERVER_AUTOMATION_HUB_TOKEN: ${{ secrets.AUTOMATION_HUB_API_KEY }}
with:
api_key: ${{ secrets.AUTOMATION_HUB_API_KEY }}
api_server: automation_hub
publish-docs:
needs: release
uses: ./.github/workflows/static.yml