Release Collection #64
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
--- | |
name: Release Collection | |
on: # yamllint disable-line rule:truthy | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
# | |
# Prepare the environment. | |
# | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get current version | |
id: current_version | |
run: echo "version=$(grep 'version:' galaxy.yml | cut -d ' ' -f 2)" >> $GITHUB_OUTPUT | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
# | |
# First stage: Build and install collection to generate docs and changelogs. | |
# | |
- name: Copy Files and Directories to Source | |
run: | | |
mkdir -p build/src | |
cp $files build/src | |
cp -rf $directories build/src | |
env: | |
files: "ansible.cfg CHANGELOG.rst galaxy.yml LICENSE README.md" | |
directories: "changelogs docs meta playbooks plugins roles" | |
- name: Build Ansible Collection | |
run: ansible-galaxy collection build build/src --force | |
- name: Install Ansible Collection | |
run: ansible-galaxy collection install --no-deps ./checkmk-general-${{ steps.current_version.outputs.version }}.tar.gz | |
- name: Compile Collection Changelog | |
run: antsibull-changelog release | |
- name: Compile Collection Docs | |
run: antsibull-docs collection --use-current --squash-hierarchy --fail-on-error --dest-dir ./docs/ checkmk.general | |
- name: Create Pull Request for docs and changelog against devel branch | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: Update Docs and Changelogs | |
committer: GitHub <[email protected]> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
signoff: false | |
branch: changelogs-docs-update-devel | |
base: devel | |
delete-branch: true | |
title: '[Auto] Update changelogs and docs' | |
body: | | |
Changelogs and docs updated during *${{ steps.current_version.outputs.version }}* release. | |
assignees: robin-checkmk | |
reviewers: robin-checkmk | |
draft: false | |
# | |
# Second stage: Build the final version of the collection and release it. | |
# | |
- name: Copy Files and Directories to Source | |
run: | | |
mkdir -p build/src | |
cp $files build/src | |
cp -rf $directories build/src | |
rm -rf build/src/roles/*/molecule | |
env: | |
files: "CHANGELOG.rst LICENSE README.md ansible.cfg galaxy.yml" | |
directories: "changelogs docs meta playbooks plugins roles" | |
- name: Build Ansible Collection | |
run: ansible-galaxy collection build build/src --force | |
- name: Create Release and upload Assets | |
id: create-release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: false | |
prerelease: false | |
name: v${{ steps.current_version.outputs.version }} | |
tag_name: v${{ steps.current_version.outputs.version }} | |
files: checkmk-general-${{ steps.current_version.outputs.version }}.tar.gz | |
body: | | |
# Ansible Collection: checkmk.general | |
For information about this collection and how to install it, refer to the [README](https://github.com/Checkmk/ansible-collection-checkmk.general/blob/main/README.md). | |
For a detailed changelog, refer to the [CHANGELOG](https://github.com/Checkmk/ansible-collection-checkmk.general/blob/main/CHANGELOG.rst). | |
- name: Publish Ansible Collection to the Galaxy | |
run: ansible-galaxy collection publish checkmk-general-${{ steps.current_version.outputs.version }}.tar.gz --api-key ${{ secrets.GALAXY_API_KEY }} |