mirror of
https://github.com/kubevirt/kubevirt.core.git
synced 2026-03-27 03:13:10 +00:00
Use Python 3.9 - 3.12 and Ansible 2.14 - 2.16, devel and milestone to run tests of the collection. Use the latest stable python version in test setups where sensible. Instead of using the integration.yml workflog from main use it from the same commit as the test runs instead. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
104 lines
3.2 KiB
YAML
104 lines
3.2 KiB
YAML
---
|
|
name: Release collection
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'kubevirt/kubevirt.core'
|
|
permissions:
|
|
actions: write
|
|
checks: write
|
|
contents: write
|
|
deployments: write
|
|
packages: write
|
|
pages: write
|
|
outputs:
|
|
tag_version: ${{ steps.get_version.outputs.TAG_VERSION }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: 3.x
|
|
cache: pip
|
|
|
|
- name: Get current version
|
|
id: get_version
|
|
run: echo "::set-output name=TAG_VERSION::$(grep version galaxy.yml | awk -F'"' '{ print $2 }')"
|
|
|
|
- name: Check if tag exists
|
|
id: check_tag
|
|
run: echo "::set-output name=TAG_EXISTS::$(git tag | grep ${{ steps.get_version.outputs.TAG_VERSION }})"
|
|
|
|
- name: Fail if tag exists
|
|
if: ${{ steps.get_version.outputs.TAG_VERSION == steps.check_tag.outputs.TAG_EXISTS }}
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
core.setFailed('Release tag already exists')
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install ansible-core antsibull
|
|
ansible-galaxy collection install -r requirements.yml -p /home/runner/.ansible/collections --force-with-deps
|
|
sudo apt install -y sed hub
|
|
|
|
- name: Build collection
|
|
run: |
|
|
ansible-galaxy collection build .
|
|
|
|
- name: Create changelog and documentation
|
|
uses: ansible-middleware/collection-docs-action@main
|
|
with:
|
|
collection_fqcn: kubevirt.core
|
|
collection_repo: kubevirt/kubevirt.core
|
|
dependencies: false
|
|
commit_changelog: true
|
|
commit_ghpages: false
|
|
changelog_release: true
|
|
generate_docs: false
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
bot_email: kubevirtbot@redhat.com
|
|
bot_account: kubevirt-bot
|
|
|
|
- name: Publish collection
|
|
env:
|
|
ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }}
|
|
run: |
|
|
ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY
|
|
|
|
- name: Create release tag
|
|
run: |
|
|
git config user.name kubevirt-bot
|
|
git config user.email kubevirtbot@redhat.com
|
|
git tag -a ${{ steps.get_version.outputs.TAG_VERSION }} -m "Release v${{ steps.get_version.outputs.TAG_VERSION }}" || true
|
|
git push origin --tags
|
|
|
|
- name: Publish Release
|
|
uses: softprops/action-gh-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ steps.get_version.outputs.TAG_VERSION }}
|
|
files: "*.tar.gz"
|
|
body_path: gh-release.md
|
|
|
|
- name: Run docs workflow
|
|
run: |
|
|
gh workflow run docs.yml --ref main
|
|
gh workflow run docs.yml --ref ${{ steps.get_version.outputs.TAG_VERSION }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run ci workflow
|
|
run: gh workflow run ci.yml --ref main
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|