389
|
1 name: "Auto release"
|
|
2
|
|
3 on:
|
|
4 workflow_dispatch:
|
|
5
|
|
6 env:
|
|
7 HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
|
|
8 HONEYCOMB_DATASET: litmus tests
|
|
9 CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
10
|
|
11 jobs:
|
|
12 auto_release:
|
|
13 name: "Automatic release prep"
|
|
14 runs-on: ubuntu-20.04
|
|
15
|
|
16 steps:
|
|
17 - name: "Honeycomb: Start recording"
|
|
18 uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
|
|
19 with:
|
|
20 apikey: ${{ env.HONEYCOMB_WRITEKEY }}
|
|
21 dataset: ${{ env.HONEYCOMB_DATASET }}
|
|
22 job-status: ${{ job.status }}
|
|
23
|
|
24 - name: "Honeycomb: start first step"
|
|
25 run: |
|
|
26 echo STEP_ID="auto-release" >> $GITHUB_ENV
|
|
27 echo STEP_START=$(date +%s) >> $GITHUB_ENV
|
|
28
|
|
29 - name: "Checkout Source"
|
|
30 if: ${{ github.repository_owner == 'puppetlabs' }}
|
|
31 uses: actions/checkout@v2
|
|
32 with:
|
|
33 fetch-depth: 0
|
|
34 persist-credentials: false
|
|
35
|
|
36 - name: "PDK Release prep"
|
|
37 uses: docker://puppet/iac_release:ci
|
|
38 with:
|
|
39 args: 'release prep --force'
|
|
40 env:
|
|
41 CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
42
|
|
43 - name: "Get Version"
|
|
44 if: ${{ github.repository_owner == 'puppetlabs' }}
|
|
45 id: gv
|
|
46 run: |
|
|
47 echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
|
|
48
|
|
49 - name: "Check if a release is necessary"
|
|
50 if: ${{ github.repository_owner == 'puppetlabs' }}
|
|
51 id: check
|
|
52 run: |
|
|
53 git diff --quiet CHANGELOG.md && echo "::set-output name=release::false" || echo "::set-output name=release::true"
|
|
54
|
|
55 - name: "Commit changes"
|
|
56 if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
|
|
57 run: |
|
|
58 git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
|
|
59 git config --local user.name "GitHub Action"
|
|
60 git add .
|
|
61 git commit -m "Release prep v${{ steps.gv.outputs.ver }}"
|
|
62
|
|
63 - name: Create Pull Request
|
|
64 id: cpr
|
|
65 uses: puppetlabs/peter-evans-create-pull-request@v3
|
|
66 if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
|
|
67 with:
|
|
68 token: ${{ secrets.GITHUB_TOKEN }}
|
|
69 commit-message: "Release prep v${{ steps.gv.outputs.ver }}"
|
|
70 branch: "release-prep"
|
|
71 delete-branch: true
|
|
72 title: "Release prep v${{ steps.gv.outputs.ver }}"
|
|
73 body: |
|
|
74 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 }}.
|
|
75 Please verify before merging:
|
|
76 - [ ] last [nightly](https://github.com/${{ github.repository }}/actions/workflows/nightly.yml) run is green
|
|
77 - [ ] [Changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) is readable and has no unlabeled pull requests
|
|
78 - [ ] 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
|
|
79 labels: "maintenance"
|
|
80
|
|
81 - name: PR outputs
|
|
82 if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
|
|
83 run: |
|
|
84 echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
|
85 echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
|
86
|
|
87 - name: "Honeycomb: Record finish step"
|
|
88 if: ${{ always() }}
|
|
89 run: |
|
|
90 buildevents step $TRACE_ID $STEP_ID $STEP_START 'Finished auto release workflow'
|