|
| 1 | +name: "Auto release" |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 3 * * 6' |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +env: |
| 9 | + HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 |
| 10 | + HONEYCOMB_DATASET: litmus tests |
| 11 | + CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 12 | + |
| 13 | +jobs: |
| 14 | + auto_release: |
| 15 | + name: "Automatic release prep" |
| 16 | + runs-on: ubuntu-20.04 |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: "Honeycomb: Start recording" |
| 20 | + uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 |
| 21 | + with: |
| 22 | + apikey: ${{ env.HONEYCOMB_WRITEKEY }} |
| 23 | + dataset: ${{ env.HONEYCOMB_DATASET }} |
| 24 | + job-status: ${{ job.status }} |
| 25 | + |
| 26 | + - name: "Honeycomb: start first step" |
| 27 | + run: | |
| 28 | + echo STEP_ID="auto-release" >> $GITHUB_ENV |
| 29 | + echo STEP_START=$(date +%s) >> $GITHUB_ENV |
| 30 | +
|
| 31 | + - name: "Checkout Source" |
| 32 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 33 | + uses: actions/checkout@v2 |
| 34 | + with: |
| 35 | + fetch-depth: 0 |
| 36 | + persist-credentials: false |
| 37 | + |
| 38 | + - name: Append PDK to Gemfile |
| 39 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 40 | + run: | |
| 41 | + echo "gem 'pdk'" >> Gemfile |
| 42 | +
|
| 43 | + - name: Activate Ruby 2.7 |
| 44 | + uses: ruby/setup-ruby@v1 |
| 45 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 46 | + with: |
| 47 | + ruby-version: "2.7" |
| 48 | + bundler-cache: true |
| 49 | + |
| 50 | + - name: Print bundle environment |
| 51 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 52 | + run: | |
| 53 | + echo ::group::bundler environment |
| 54 | + buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env |
| 55 | + echo ::endgroup:: |
| 56 | +
|
| 57 | + - name: "Honeycomb: Record Bundler Setup time" |
| 58 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 59 | + run: | |
| 60 | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Bundler Setup' |
| 61 | + echo STEP_ID="auto_release_setup" >> $GITHUB_ENV |
| 62 | + echo STEP_START=$(date +%s) >> $GITHUB_ENV |
| 63 | +
|
| 64 | + - name: "PDK Release prep" |
| 65 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 66 | + run: | |
| 67 | + buildevents cmd $TRACE_ID $STEP_ID 'pdk release prep' -- bundle exec pdk release prep --force |
| 68 | +
|
| 69 | + - name: "Commit changes" |
| 70 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 71 | + run: | |
| 72 | + git config --local user.email "[email protected]" |
| 73 | + git config --local user.name "GitHub Action" |
| 74 | + git add . |
| 75 | + git commit -m "Auto-Release prep" |
| 76 | +
|
| 77 | + - name: "Get Version" |
| 78 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 79 | + id: gv |
| 80 | + run: | |
| 81 | + echo "::set-output name=ver::$(cat metadata.json | jq .version)" |
| 82 | +
|
| 83 | + - name: Create Pull Request |
| 84 | + id: cpr |
| 85 | + uses: puppetlabs/peter-evans-create-pull-request@v3 |
| 86 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 87 | + with: |
| 88 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + commit-message: "Release prep v${{ steps.gv.outputs.ver }}" |
| 90 | + branch: "release-prep" |
| 91 | + delete-branch: true |
| 92 | + title: "Release prep v${{ steps.gv.outputs.ver }}" |
| 93 | + labels: "maintenance" |
| 94 | + |
| 95 | + - name: PR outputs |
| 96 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 97 | + run: | |
| 98 | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" |
| 99 | + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |
0 commit comments