From 36966a15287e5d73bb8e2f0860838d48b1ee38d3 Mon Sep 17 00:00:00 2001 From: gardar Date: Fri, 17 Feb 2023 18:44:34 +0000 Subject: [PATCH 1/8] fix: add collection changelog Signed-off-by: gardar --- .config/ansible-lint.yml | 2 ++ CHANGELOG.rst | 14 ++++++++++++++ changelogs/.plugin-cache.yaml | 17 +++++++++++++++++ changelogs/changelog.yaml | 8 ++++++++ changelogs/config.yaml | 33 +++++++++++++++++++++++++++++++++ galaxy.yml | 7 +------ test-requirements.txt | 2 ++ 7 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 CHANGELOG.rst create mode 100644 changelogs/.plugin-cache.yaml create mode 100644 changelogs/changelog.yaml create mode 100644 changelogs/config.yaml diff --git a/.config/ansible-lint.yml b/.config/ansible-lint.yml index 9cd26302..4caf7792 100644 --- a/.config/ansible-lint.yml +++ b/.config/ansible-lint.yml @@ -1,2 +1,4 @@ --- profile: production +warn_list: + - galaxy[version-incorrect] # until collection gets bumped to 1.x.x diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 00000000..104b6287 --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,14 @@ +=================================== +Prometheus.Prometheus Release Notes +=================================== + +.. contents:: Topics + + +v0.0.1 +====== + +Major Changes +------------- + +- Initial Release diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml new file mode 100644 index 00000000..d72150a1 --- /dev/null +++ b/changelogs/.plugin-cache.yaml @@ -0,0 +1,17 @@ +--- +objects: {} +plugins: + become: {} + cache: {} + callback: {} + cliconf: {} + connection: {} + httpapi: {} + inventory: {} + lookup: {} + module: {} + netconf: {} + shell: {} + strategy: {} + vars: {} +version: 0.0.1 diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml new file mode 100644 index 00000000..35358e86 --- /dev/null +++ b/changelogs/changelog.yaml @@ -0,0 +1,8 @@ +--- +ancestor: +releases: + 0.0.1: + changes: + major_changes: + - 'Initial Release' + release_date: '2023-02-17' diff --git a/changelogs/config.yaml b/changelogs/config.yaml new file mode 100644 index 00000000..f644f387 --- /dev/null +++ b/changelogs/config.yaml @@ -0,0 +1,33 @@ +--- +changelog_filename_template: ../CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +ignore_other_fragment_extensions: true +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: "Release Summary" +sanitize_changelog: true +sections: + - - major_changes + - "Major Changes" + - - minor_changes + - "Minor Changes" + - - breaking_changes + - "Breaking Changes / Porting Guide" + - - deprecated_features + - "Deprecated Features" + - - removed_features + - "Removed Features (previously deprecated)" + - - security_fixes + - "Security Fixes" + - - bugfixes + - "Bugfixes" + - - known_issues + - "Known Issues" +title: Prometheus.Prometheus +trivial_section_name: trivial +use_fqcn: true diff --git a/galaxy.yml b/galaxy.yml index 10639c6d..6bef2a91 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,13 +1,11 @@ --- namespace: prometheus name: prometheus -version: 1.0.0 - +version: 0.0.1 readme: README.md authors: - "Ben Kochie (https://github.com/SuperQ)" - "Paweł Krupa (https://github.com/paulfantom)" - description: "Ansible Collection for Prometheus" license_file: LICENSE tags: @@ -19,16 +17,13 @@ tags: - alerts - alerting - cloud - dependencies: community.crypto: '>=2.0.0' community.general: '>=1.0.0' - repository: "https://github.com/prometheus-community/ansible" documentation: "https://github.com/prometheus-community/ansible/blob/main/docs" homepage: "https://prometheus.io" issues: "https://github.com/prometheus-community/ansible/issues" - build_ignore: - 'tests/*' - '*.tar.gz' diff --git a/test-requirements.txt b/test-requirements.txt index 88cefd1d..859b1710 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,5 @@ +antsibull-changelog +antsichaut molecule docker ansible-lint From 918e7863fd1866c567eae5cb5c6d013349ea5f3e Mon Sep 17 00:00:00 2001 From: gardar Date: Fri, 17 Feb 2023 18:51:36 +0000 Subject: [PATCH 2/8] feat: add ci workflow for auto generating changelog Signed-off-by: gardar --- .github/release-drafter.yml | 52 ++++++++++++++++ .github/version-drafter.yml | 4 ++ .github/workflows/publish_latest.yml | 89 ---------------------------- .github/workflows/release.yml | 81 +++++++++++++++++++++++++ CONTRIBUTING.md | 6 +- 5 files changed, 140 insertions(+), 92 deletions(-) create mode 100644 .github/release-drafter.yml create mode 100644 .github/version-drafter.yml delete mode 100644 .github/workflows/publish_latest.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..d19fcfbc --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,52 @@ +name-template: '$RESOLVED_VERSION' +tag-template: '$RESOLVED_VERSION' +categories: + - title: 'Major Changes' + labels: + - 'major' # c6476b + - title: 'Minor Changes' + labels: + - 'feature' # 006b75 + - 'enhancement' # ededed + - 'refactoring' + - title: 'Bugfixes' + labels: + - 'bug' # fbca04 + - title: 'Deprecations' + labels: + - 'deprecated' # fef2c0 +exclude-labels: + - 'skip-changelog' + - 'duplicate' +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + - 'feature' + - 'enhancement' + - 'refactoring' + patch: + labels: + - 'patch' + - 'bug' + - 'deprecated' + default: patch +autolabeler: + - label: 'skip-changelog' + title: '/chore/i' + - label: 'bug' + title: '/fix/i' + - label: 'enhancement' + title: '/(enhance|improve)/i' + - label: 'feature' + title: '/feature/i' + - label: 'dreprecated' + title: '/deprecat/i' +change-template: '* $TITLE by @$AUTHOR in #$NUMBER' +template: | + What's Changed + === + $CHANGES diff --git a/.github/version-drafter.yml b/.github/version-drafter.yml new file mode 100644 index 00000000..a5415f61 --- /dev/null +++ b/.github/version-drafter.yml @@ -0,0 +1,4 @@ +--- +major-labels: ['semver:major', 'major', 'breaking'] +minor-labels: ['semver:minor', 'minor', 'enhancement', 'deprecated', 'removed', 'security'] +patch-labels: ['semver:patch', 'bug', 'trivial', 'bugfix'] diff --git a/.github/workflows/publish_latest.yml b/.github/workflows/publish_latest.yml deleted file mode 100644 index 82640893..00000000 --- a/.github/workflows/publish_latest.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Publish Collection -on: - push: - branches: - - main - release: - types: - - 'published' - -env: - python-version: 3.9 - -jobs: - publish-latest: - if: github.event_name == 'push' - runs-on: ubuntu-22.04 - defaults: - run: - working-directory: ansible_collections/prometheus/prometheus - steps: - - name: Check out code - uses: actions/checkout@v2 - with: - path: ansible_collections/prometheus/prometheus - - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: ${{ env.python-version }} - - - name: Install ansible-base (devel) - run: pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check - - - name: Build the collection - run: ansible-galaxy collection build - - - name: Rename the build artifact - run: mv prometheus-prometheus-*.tar.gz prometheus-community-prometheus-latest.tar.gz - - # Moving the tag leaves an orphan artifact. Just changing the artifact doesn't move the tag. - - name: Delete latest tag and release - uses: dev-drprasad/delete-tag-and-release@v0.1.2 - with: - delete_release: true - tag_name: latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Upload files to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ansible_collections/prometheus/prometheus/prometheus-community-prometheus-latest.tar.gz - asset_name: prometheus-community-prometheus-latest.tar.gz - body: "Development release" - tag: latest - overwrite: true - - publish-tagged: - if: github.event_name == 'release' - runs-on: ubuntu-22.04 - defaults: - run: - working-directory: ansible_collections/prometheus/prometheus - steps: - - name: Check out code - uses: actions/checkout@v2 - with: - path: ansible_collections/prometheus/prometheus - - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: ${{ env.python-version }} - - - name: Install ansible-base (devel) - run: pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check - - - name: Build the collection - run: ansible-galaxy collection build - - - name: Upload files to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ansible_collections/prometheus/prometheus/prometheus-community-prometheus-*.tar.gz - file_glob: true - tag: ${{ github.ref }} - overwrite: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..76963d4d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,81 @@ +--- +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-release') + 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: gardar/antsichaut-action@yaml-lint # Until PR gets merged: https://github.com/rndmh3ro/antsichaut/pull/4 + 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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f922673f..ef555c89 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,9 +42,9 @@ to a commit with merge request. Available keywords are (square brackets are impo * `[major]`, `[breaking change]` - for MAJOR version release ## Changelog - -Changelog is generated automatically during release process and all information is taken from github issues, PRs and -labels. +This project uses [antsibull-changelog](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections_changelogs.html#generating-changelogs) to generate changelogs. + +Changelog is generated automatically during release process and all information is taken from github PRs, commits and labels. ## Expectations From fefb760ae3a4361bc55bb9c91632b6e3644a9211 Mon Sep 17 00:00:00 2001 From: gardar Date: Fri, 17 Feb 2023 18:53:28 +0000 Subject: [PATCH 3/8] fix: avoid running tests after merge/release Signed-off-by: gardar --- .github/workflows/ansible-ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ansible-ci.yml b/.github/workflows/ansible-ci.yml index 1fcbe26c..a1a7b3d2 100644 --- a/.github/workflows/ansible-ci.yml +++ b/.github/workflows/ansible-ci.yml @@ -1,6 +1,13 @@ --- name: Ansible CI -on: [push, pull_request] +on: + push: + branches-ignore: + - main + pull_request: + types: + - '!closed' + workflow_dispatch: env: ANSIBLE_FORCE_COLOR: true From 24aa8019c32fefbc358b4d9f11e806b5c09f3cfd Mon Sep 17 00:00:00 2001 From: gardar Date: Fri, 17 Feb 2023 18:54:03 +0000 Subject: [PATCH 4/8] fix: avoid ansible galaxy timeout errors in ci Signed-off-by: gardar --- .github/workflows/ansible-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ansible-ci.yml b/.github/workflows/ansible-ci.yml index a1a7b3d2..11c52958 100644 --- a/.github/workflows/ansible-ci.yml +++ b/.github/workflows/ansible-ci.yml @@ -11,6 +11,9 @@ on: env: ANSIBLE_FORCE_COLOR: true + ANSIBLE_GALAXY_SERVER_GALAXY_URL: "https://galaxy.ansible.com" + ANSIBLE_GALAXY_SERVER_GALAXY_TIMEOUT: 120 + ANSIBLE_GALAXY_SERVER_LIST: "galaxy" jobs: ansible-lint: From ecd7cb265dd660a2def7ebe909fd28752f0d424b Mon Sep 17 00:00:00 2001 From: gardar Date: Fri, 17 Feb 2023 19:13:22 +0000 Subject: [PATCH 5/8] feat: auto label PR's with conventional commits Signed-off-by: gardar --- .github/workflows/conventional-label.yml | 38 ++++++++++++++++++++++++ CONTRIBUTING.md | 16 +++++----- 2 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/conventional-label.yml diff --git a/.github/workflows/conventional-label.yml b/.github/workflows/conventional-label.yml new file mode 100644 index 00000000..de818d6e --- /dev/null +++ b/.github/workflows/conventional-label.yml @@ -0,0 +1,38 @@ +--- +on: + pull_request: + types: [opened, edited, synchronize, reopened] +name: Auto label pull request +jobs: + label: + runs-on: ubuntu-latest + steps: + - name: "Confirm correct pull request title" + uses: deepakputhraya/action-pr-title@master + with: + allowed_prefixes: 'feat,fix,major,breaking,minor,enhancement,deprecated,removed,security,bug,bugfix,docs,packaging,test,refactor,refactoring,skip-release' + + - name: "Apply label" + if: github.event.pull_request.labels.length == 0 + uses: bcoe/conventional-release-labels@v1 + with: + type_labels: | + { + "feat": "enhancement", + "fix": "bugfix", + "major": "major", + "breaking": "breaking", + "minor": "minor", + "enhancement": "enhancement", + "deprecated": "deprecated", + "removed": "removed", + "security": "security", + "bug": "bug", + "bugfix": "bugfix", + "docs": "trivial", + "packaging": "trivial", + "test": "trivial", + "refactor": "trivial", + "refactoring": "trivial", + "skip-release": "skip-release" + } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ef555c89..24f73838 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,21 +25,19 @@ To have your code merged, see the expectations listed below. You can find a well-written guide [here](https://help.github.com/articles/fork-a-repo). -Please follow common commit best-practices. Be explicit, have a short summary, a well-written description and +Please follow conventional commits for best-practices. Be explicit, have a short summary, a well-written description and references. This is especially important for the merge-request. -Some great guidelines can be found [here](https://wiki.openstack.org/wiki/GitCommitMessages) and -[here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message). +Some great guidelines can be found [here](https://www.conventionalcommits.org/). ## Releases -We try to stick to semantic versioning and our releases are automated. Release is created by assigning a keyword (in a -way similar to circle ci keyword [`[ci skip]`](https://docs.travis-ci.com/user/customizing-the-build#Skipping-a-build)) -to a commit with merge request. Available keywords are (square brackets are important!): +We try to stick to semantic versioning and our releases are automated. Release is created by assigning [conventional commits](https://www.conventionalcommits.org/) +to PR title. Available keywords are: -* `[patch]`, `[fix]`, `[bugfix]` - for PATCH version release -* `[minor]`, `[feature]`, `[feat]` - for MINOR version release -* `[major]`, `[breaking change]` - for MAJOR version release +* `[patch]`, `[fix]`, `[bug]`, `[bugfix]`, `[test]`, `[refactor]`, `[packaging]`, `[docs]` - for PATCH version release +* `[minor]`, `[enhancement]`, `[feat]`, `[deprecated]`, `[removed]`, `[security]` - for MINOR version release +* `[major]`, `[breaking]` - for MAJOR version release ## Changelog This project uses [antsibull-changelog](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections_changelogs.html#generating-changelogs) to generate changelogs. From cb5c6c435d7658184cf2e56d11bed8eaca429321 Mon Sep 17 00:00:00 2001 From: gardar Date: Tue, 21 Feb 2023 12:14:14 +0000 Subject: [PATCH 6/8] fix: use antsichaut from upstream Signed-off-by: gardar --- .github/workflows/conventional-label.yml | 5 +++-- .github/workflows/release.yml | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/conventional-label.yml b/.github/workflows/conventional-label.yml index de818d6e..d69f7cb4 100644 --- a/.github/workflows/conventional-label.yml +++ b/.github/workflows/conventional-label.yml @@ -10,7 +10,7 @@ jobs: - name: "Confirm correct pull request title" uses: deepakputhraya/action-pr-title@master with: - allowed_prefixes: 'feat,fix,major,breaking,minor,enhancement,deprecated,removed,security,bug,bugfix,docs,packaging,test,refactor,refactoring,skip-release' + allowed_prefixes: 'feat,fix,major,breaking,minor,enhancement,deprecated,removed,security,bug,bugfix,docs,packaging,test,refactor,refactoring,skip-release,skip_changelog' - name: "Apply label" if: github.event.pull_request.labels.length == 0 @@ -34,5 +34,6 @@ jobs: "test": "trivial", "refactor": "trivial", "refactoring": "trivial", - "skip-release": "skip-release" + "skip-release": "skip_changelog", + "skip_changelog": "skip_changelog" } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 76963d4d..e94691a1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: if: | github.event.pull_request.merged && github.ref == github.event.repository.default_branch && - !contains(github.event.pull_request.labels.*.name, 'skip-release') + !contains(github.event.pull_request.labels.*.name, 'skip_changelog') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -33,7 +33,7 @@ jobs: run: antsibull-changelog release -v --version "${{ steps.version.outputs.next-version }}" - name: "Run antsichaut" - uses: gardar/antsichaut-action@yaml-lint # Until PR gets merged: https://github.com/rndmh3ro/antsichaut/pull/4 + uses: rndmh3ro/antsichaut-action@main with: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" since_version: "${{ steps.version.outputs.current-version }}" From 620acbb7dee4fccaceb6f04f65e53e1c8692f1b2 Mon Sep 17 00:00:00 2001 From: gardar Date: Thu, 23 Feb 2023 10:55:13 +0000 Subject: [PATCH 7/8] fix: support `feature` label Signed-off-by: gardar --- .github/workflows/conventional-label.yml | 3 ++- CONTRIBUTING.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/conventional-label.yml b/.github/workflows/conventional-label.yml index d69f7cb4..67d91714 100644 --- a/.github/workflows/conventional-label.yml +++ b/.github/workflows/conventional-label.yml @@ -10,7 +10,7 @@ jobs: - name: "Confirm correct pull request title" uses: deepakputhraya/action-pr-title@master with: - allowed_prefixes: 'feat,fix,major,breaking,minor,enhancement,deprecated,removed,security,bug,bugfix,docs,packaging,test,refactor,refactoring,skip-release,skip_changelog' + allowed_prefixes: 'feat,feature,fix,major,breaking,minor,enhancement,deprecated,removed,security,bug,bugfix,docs,packaging,test,refactor,refactoring,skip-release,skip_changelog' - name: "Apply label" if: github.event.pull_request.labels.length == 0 @@ -18,6 +18,7 @@ jobs: with: type_labels: | { + "feature": "enhancement", "feat": "enhancement", "fix": "bugfix", "major": "major", diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 24f73838..b5874b27 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,7 +36,7 @@ We try to stick to semantic versioning and our releases are automated. Release i to PR title. Available keywords are: * `[patch]`, `[fix]`, `[bug]`, `[bugfix]`, `[test]`, `[refactor]`, `[packaging]`, `[docs]` - for PATCH version release -* `[minor]`, `[enhancement]`, `[feat]`, `[deprecated]`, `[removed]`, `[security]` - for MINOR version release +* `[minor]`, `[enhancement]`, `[feature]`, `[feat]`, `[deprecated]`, `[removed]`, `[security]` - for MINOR version release * `[major]`, `[breaking]` - for MAJOR version release ## Changelog From 779c4f4abde61a6e73599c254292637a4cad5445 Mon Sep 17 00:00:00 2001 From: gardar Date: Thu, 23 Feb 2023 12:05:43 +0000 Subject: [PATCH 8/8] fix: don't auto publish releases Signed-off-by: gardar --- .github/workflows/publish.yml | 27 +++++++++++++++++++++++++++ .github/workflows/release.yml | 22 +--------------------- 2 files changed, 28 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..a289ab78 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,27 @@ +--- +name: Ansible collection publish +on: + push: + tags: + - '*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: "Install tools" + run: "python -m pip install ansible-base --disable-pip-version-check" + + - name: "Build the collection" + run: ansible-galaxy collection build + + - 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: ${{ github.ref }} + overwrite: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e94691a1..90ec5f6c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,9 +26,6 @@ jobs: 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 }}" @@ -46,9 +43,6 @@ jobs: 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: @@ -56,26 +50,12 @@ jobs: commit_message: "chore: update version" - name: "Checkout updated branch" - uses: actions/checkout@v3.3.0 + uses: actions/checkout@v3 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