-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5948bf
commit 580ac13
Showing
1 changed file
with
6 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,80 +3,17 @@ 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 | ||
with: | ||
ref: v1.6.0 | ||
- 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 }} | ||
uses: ansible/ansible-content-actions/.github/workflows/release_ah.yaml | ||
with: | ||
api_key: ${{ secrets.AUTOMATION_HUB_API_KEY }} | ||
api_server: https://console.redhat.com/api/automation-hub/ | ||
|
||
publish-docs: | ||
needs: release | ||
uses: ./.github/workflows/static.yml | ||
environment: release | ||
secrets: | ||
ah_token: ${{ secrets.AUTOMATION_HUB_API_KEY }} |