|
1 |
| -name: "Auto release" |
2 |
| - |
| 1 | +--- |
| 2 | +name: Auto release |
3 | 3 | on:
|
4 | 4 | workflow_dispatch:
|
5 |
| - |
6 | 5 | env:
|
7 | 6 | CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
8 |
| - |
9 | 7 | jobs:
|
10 | 8 | auto_release:
|
11 |
| - name: "Automatic release prep" |
| 9 | + name: Automatic release prep |
12 | 10 | runs-on: ubuntu-20.04
|
13 |
| - |
14 | 11 | steps:
|
15 |
| - - name: "Checkout Source" |
16 |
| - if: ${{ github.repository_owner == 'puppetlabs' }} |
17 |
| - uses: actions/checkout@v4 |
18 |
| - with: |
19 |
| - fetch-depth: 0 |
20 |
| - persist-credentials: false |
21 |
| - |
22 |
| - - name: "PDK Release prep" |
23 |
| - uses: docker://puppet/puppet-dev-tools:4.x |
24 |
| - with: |
25 |
| - args: 'pdk release prep --force --debug' |
26 |
| - env: |
27 |
| - CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
28 |
| - |
29 |
| - - name: "Get Version" |
30 |
| - if: ${{ github.repository_owner == 'puppetlabs' }} |
31 |
| - id: gv |
32 |
| - run: | |
33 |
| - echo "::set-output name=ver::$(jq --raw-output .version metadata.json)" |
34 |
| -
|
35 |
| - - name: "Check if a release is necessary" |
36 |
| - if: ${{ github.repository_owner == 'puppetlabs' }} |
37 |
| - id: check |
38 |
| - run: | |
39 |
| - git diff --quiet CHANGELOG.md && echo "::set-output name=release::false" || echo "::set-output name=release::true" |
40 |
| -
|
41 |
| - - name: "Commit changes" |
42 |
| - if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} |
43 |
| - run: | |
44 |
| - git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com" |
45 |
| - git config --local user.name "GitHub Action" |
46 |
| - git add . |
47 |
| - git commit -m "Release prep v${{ steps.gv.outputs.ver }}" |
48 |
| -
|
49 |
| - - name: Create Pull Request |
50 |
| - id: cpr |
51 |
| - uses: puppetlabs/peter-evans-create-pull-request@v3 |
52 |
| - if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} |
53 |
| - with: |
54 |
| - token: ${{ secrets.GITHUB_TOKEN }} |
55 |
| - commit-message: "Release prep v${{ steps.gv.outputs.ver }}" |
56 |
| - branch: "release-prep" |
57 |
| - delete-branch: true |
58 |
| - title: "Release prep v${{ steps.gv.outputs.ver }}" |
59 |
| - body: | |
60 |
| - 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 }}. |
61 |
| - Please verify before merging: |
62 |
| - - [ ] last [nightly](https://github.com/${{ github.repository }}/actions/workflows/nightly.yml) run is green |
63 |
| - - [ ] [Changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) is readable and has no unlabeled pull requests |
64 |
| - - [ ] 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 |
65 |
| - labels: "maintenance" |
66 |
| - |
67 |
| - - name: PR outputs |
68 |
| - if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} |
69 |
| - run: | |
70 |
| - echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" |
71 |
| - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |
| 12 | + - name: Checkout Source |
| 13 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 14 | + uses: actions/checkout@v4 |
| 15 | + with: |
| 16 | + fetch-depth: 0 |
| 17 | + persist-credentials: false |
| 18 | + - name: PDK Release prep |
| 19 | + uses: docker://puppet/puppet-dev-tools:4.x |
| 20 | + with: |
| 21 | + args: pdk release prep --force --debug |
| 22 | + env: |
| 23 | + CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 24 | + - name: Get Version |
| 25 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 26 | + id: gv |
| 27 | + run: | |
| 28 | + echo "::set-output name=ver::$(jq --raw-output .version metadata.json)" |
| 29 | + - name: Check if a release is necessary |
| 30 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 31 | + id: check |
| 32 | + run: | |
| 33 | + git diff --quiet CHANGELOG.md && echo "::set-output name=release::false" || echo "::set-output name=release::true" |
| 34 | + - name: Commit changes |
| 35 | + if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} |
| 36 | + run: | |
| 37 | + git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com" |
| 38 | + git config --local user.name "GitHub Action" |
| 39 | + git add . |
| 40 | + git commit -m "Release prep v${{ steps.gv.outputs.ver }}" |
| 41 | + - name: Create Pull Request |
| 42 | + id: cpr |
| 43 | + uses: puppetlabs/peter-evans-create-pull-request@v3 |
| 44 | + if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} |
| 45 | + with: |
| 46 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 47 | + commit-message: Release prep v${{ steps.gv.outputs.ver }} |
| 48 | + branch: release-prep |
| 49 | + delete-branch: true |
| 50 | + title: Release prep v${{ steps.gv.outputs.ver }} |
| 51 | + body: | |
| 52 | + 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 }}. |
| 53 | + Please verify before merging: |
| 54 | + - [ ] last [nightly](https://github.com/${{ github.repository }}/actions/workflows/nightly.yml) run is green |
| 55 | + - [ ] [Changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) is readable and has no unlabeled pull requests |
| 56 | + - [ ] 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 |
| 57 | + labels: maintenance |
| 58 | + - name: PR outputs |
| 59 | + if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} |
| 60 | + run: |- |
| 61 | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" |
| 62 | + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |
0 commit comments