-
Notifications
You must be signed in to change notification settings - Fork 24
84 lines (73 loc) · 3.21 KB
/
Copy pathrelease_prep.yml
File metadata and controls
84 lines (73 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: "release prep"
on:
workflow_dispatch:
inputs:
target:
description: "The target for the release. This can be a commit sha or a branch."
required: false
default: "main"
type: "string"
version:
description: "Version to be released."
required: true
type: "string"
jobs:
release_prep:
name: "Release prep"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
ref: ${{ github.event.inputs.target }}
clean: true
fetch-depth: 0
- name: "setup ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: "3.1"
bundler-cache: "true"
- name: "bundle environment"
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::
- name: "Update Version"
run: |
current_version=$(ruby -e "require './lib/puppet_editor_services/version'; puts PuppetEditorServices::PUPPETEDITORSERVICESVERSION.to_s")
sed -i "s/$current_version/${{ github.event.inputs.version }}/g" $(find . -path './lib/**' -name 'version.rb' -not -path "vendor/*")
- 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: "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${{ github.event.inputs.version }}"
- name: "Create pull Request"
uses: "peter-evans/create-pull-request@v4"
if: ${{ steps.check.outputs.release == 'true' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Release prep v${{ github.event.inputs.version }}"
branch: "release-prep"
delete-branch: true
title: "Release prep v${{ github.event.inputs.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"