(maint) pdksync - PDK Update
[puppet-modules/puppetlabs-apt.git] / .github / workflows / auto_release.yml
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: "Commit changes"
50       if: ${{ github.repository_owner == 'puppetlabs' }}
51       run: |
52         git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
53         git config --local user.name "GitHub Action"
54         git add .
55         git commit -m "Release prep v${{ steps.gv.outputs.ver }}"
56
57     - name: Create Pull Request
58       id: cpr
59       uses: puppetlabs/peter-evans-create-pull-request@v3
60       if: ${{ github.repository_owner == 'puppetlabs' }}
61       with:
62         token: ${{ secrets.GITHUB_TOKEN }}
63         commit-message: "Release prep v${{ steps.gv.outputs.ver }}"
64         branch: "release-prep"
65         delete-branch: true
66         title: "Release prep v${{ steps.gv.outputs.ver }}"
67         body: |
68           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 }}. 
69           Please verify before merging:
70           - [ ] last [nightly](https://github.com/${{ github.repository }}/actions/workflows/nightly.yml) run is green
71           - [ ] [Changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) is readable and has no unlabeled pull requests
72           - [ ] 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
73         labels: "maintenance"
74
75     - name: PR outputs
76       if: ${{ github.repository_owner == 'puppetlabs' }}
77       run: |
78         echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
79         echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
80
81     - name: "Honeycomb: Record finish step"
82       if: ${{ always() }}
83       run: |
84         buildevents step $TRACE_ID $STEP_ID $STEP_START 'Finished auto release workflow'