Skip to content

Commit

Permalink
(CAT-1684) Implement custom workflow rather than reusable
Browse files Browse the repository at this point in the history
The reusable workflow is unfit for purpose as the templates do not contain the metadata.json that it expects.
  • Loading branch information
david22swan committed Jan 15, 2024
1 parent ba21431 commit f18ffca
Showing 1 changed file with 62 additions and 4 deletions.
66 changes: 62 additions & 4 deletions .github/workflows/release_prep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,68 @@ on:
version:
description: "Template version, must match the version for the PDK release it is being bundled with."
required: true
type: "string"

jobs:
release_prep:
uses: "puppetlabs/cat-github-actions/.github/workflows/module_release_prep.yml@main"
with:
version: "${{ github.event.inputs.version }}"
secrets: "inherit"
name: "Release prep"
runs-on: "ubuntu-20.04"

steps:

- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 0

- name: "Generate changelog"
run: |
export GH_HOST=github.com
gh extension install chelnak/gh-changelog
gh changelog new --next-version v${{ github.event.inputs.version }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "setup ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: "3.2"
bundler-cache: "true"
bundler: 2.4.22

- name: "bundle environment"
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::
- name: "Check if a release is necessary"
id: "check"
run: |
git diff --quiet CHANGELOG.md && echo "release=false" >> $GITHUB_OUTPUT || echo "release=true" >> $GITHUB_OUTPUT
- name: "Commit changes"
if: ${{ steps.check.outputs.release == 'true' }}
run: |
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
git config --local user.name "GitHub Actions"
git add .
git commit -m "Release prep v${{ steps.get_version.outputs.version }}"
- name: "Create pull Request"
uses: "peter-evans/create-pull-request@v5"
if: ${{ steps.check.outputs.release == 'true' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Release prep v${{ steps.get_version.outputs.version }}"
branch: "release-prep"
delete-branch: true
title: "Release prep v${{ steps.get_version.outputs.version }}"
base: "main"
body: |
Automated release-prep through [pdk-templates](https://github.com/puppetlabs/pdk-templates/blob/main/moduleroot/.github/workflows/auto_release.yml.erb) from commit ${{ github.sha }}.
Please verify before merging:
- [ ] last [nightly](https://github.com/${{ github.repository }}/actions/workflows/nightly.yml) run is green
- [ ] [Changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) is readable and has no unlabeled pull requests
- [ ] Ensure the [changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) version and [metadata](https://github.com/${{ github.repository }}/blob/release-prep/metadata.json) version match
labels: "maintenance"

0 comments on commit f18ffca

Please sign in to comment.