mirror of
https://github.com/kubevirt/kubevirt.core.git
synced 2026-05-08 06:12:39 +00:00
.github: Cleanup actions
Cleanup the .github actions: - Use the same syntax and/or commands where possible - Drop unnecessary parameters and steps / commands - In the all-green job ensure that all CI jobs passed - Update the naming of jobs - Review permissions and grant write permission only where necessary (repo is set to read-only by default) - Review installed dependencies (try to fix the failing docs job) - Run yamllint and fix findings - Replace deprecated set-output syntax Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This commit is contained in:
49
.github/workflows/release.yml
vendored
49
.github/workflows/release.yml
vendored
@@ -1,22 +1,21 @@
|
||||
---
|
||||
name: Release collection
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
# Do not run in private forks
|
||||
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 }}
|
||||
tag_version: ${{ steps.version.outputs.VERSION }}
|
||||
permissions:
|
||||
contents: write
|
||||
actions: write
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -29,15 +28,19 @@ jobs:
|
||||
cache: pip
|
||||
|
||||
- name: Get current version
|
||||
id: get_version
|
||||
run: echo "::set-output name=TAG_VERSION::$(grep version galaxy.yml | awk -F'"' '{ print $2 }')"
|
||||
id: version
|
||||
run: |
|
||||
VERSION=$(grep version galaxy.yml | awk -F'"' '{ print $2 }')
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Check if tag exists
|
||||
id: check_tag
|
||||
run: echo "::set-output name=TAG_EXISTS::$(git tag | grep ${{ steps.get_version.outputs.TAG_VERSION }})"
|
||||
id: exists
|
||||
run: |
|
||||
EXISTS=$(git tag | grep ${{ steps.version.outputs.VERSION }})
|
||||
echo "EXISTS=$EXISTS" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Fail if tag exists
|
||||
if: ${{ steps.get_version.outputs.TAG_VERSION == steps.check_tag.outputs.TAG_EXISTS }}
|
||||
if: ${{ steps.version.outputs.VERSION == steps.exists.outputs.EXISTS }}
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
@@ -47,7 +50,8 @@ jobs:
|
||||
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
|
||||
ansible-galaxy collection install -r requirements.yml \
|
||||
-p /home/runner/.ansible/collections --force-with-deps
|
||||
sudo apt install -y sed hub
|
||||
|
||||
- name: Build collection
|
||||
@@ -69,31 +73,34 @@ jobs:
|
||||
bot_account: kubevirt-bot
|
||||
|
||||
- name: Publish collection
|
||||
run: |
|
||||
ansible-galaxy collection publish *.tar.gz \
|
||||
--api-key "$ANSIBLE_GALAXY_API_KEY"
|
||||
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 tag -a ${{ steps.version.outputs.VERSION }} \
|
||||
-m "Release v${{ steps.version.outputs.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 }}
|
||||
tag_name: ${{ steps.version.outputs.VERSION }}
|
||||
files: "*.tar.gz"
|
||||
body_path: gh-release.md
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Run docs workflow
|
||||
run: |
|
||||
gh workflow run docs.yml --ref main
|
||||
gh workflow run docs.yml --ref ${{ steps.get_version.outputs.TAG_VERSION }}
|
||||
gh workflow run docs.yml \
|
||||
--ref ${{ steps.version.outputs.VERSION }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user