ansible-collection-prometheus/.github/workflows/release.yml
gardar cb5c6c435d
fix: use antsichaut from upstream
Signed-off-by: gardar <gardar@users.noreply.github.com>
2023-02-21 12:14:14 +00:00

81 lines
2.5 KiB
YAML

---
name: Ansible collection release
on:
pull_request:
types:
- closed
jobs:
release:
if: |
github.event.pull_request.merged &&
github.ref == github.event.repository.default_branch &&
!contains(github.event.pull_request.labels.*.name, 'skip_changelog')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Install tools"
run: "python -m pip install ansible-base antsibull-changelog --disable-pip-version-check"
- name: "Calculate next version"
id: version
uses: gardar/version-drafter-action@event-triggers # Until PR gets merged: https://github.com/patrickjahns/version-drafter-action/pull/343
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: "Check git repo before changelog"
run: git status
- name: "Generate new version in changelog.yaml"
run: antsibull-changelog release -v --version "${{ steps.version.outputs.next-version }}"
- name: "Run antsichaut"
uses: rndmh3ro/antsichaut-action@main
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
since_version: "${{ steps.version.outputs.current-version }}"
- name: "Update Changelog.rst"
run: "antsibull-changelog generate -v"
- name: "Update collection version"
uses: mikefarah/yq@master
with:
cmd: yq -i '.version = "${{ steps.version.outputs.next-version }}"' 'galaxy.yml'
- name: "Check git repo"
run: git status
- name: "Write changelog and version"
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.event.pull_request.base.ref }}
commit_message: "chore: update version"
- name: "Checkout updated branch"
uses: actions/checkout@v3.3.0
with:
ref: ${{ github.event.pull_request.base.ref }}
- name: "Build the collection"
run: ansible-galaxy collection build
- name: "Publish release"
id: release-publish
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
publish: true
- name: "Upload built collection to release"
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: prometheus-prometheus-*.tar.gz
file_glob: true
tag: ${{ steps.release-publish.outputs.tag_name }}
overwrite: true