X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=.github%2Fworkflows%2Fauto_release.yml;h=f4aed440e59f3df863604acd8a0af1563e572319;hb=e8cd1d2bd0d5cc5c436cebc6a92de5219da0fc24;hp=a88b99ca17a1215d11e754f43e8b258cbe3153a4;hpb=89803a41b5f3e1fa44db4e9c6a99e155f6771d5a;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/.github/workflows/auto_release.yml b/.github/workflows/auto_release.yml index a88b99c..f4aed44 100644 --- a/.github/workflows/auto_release.yml +++ b/.github/workflows/auto_release.yml @@ -1,8 +1,6 @@ name: "Auto release" on: - schedule: - - cron: '0 3 * * 6' workflow_dispatch: env: @@ -16,6 +14,7 @@ jobs: runs-on: ubuntu-20.04 steps: + - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: @@ -27,7 +26,6 @@ jobs: run: | echo STEP_ID="auto-release" >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: "Checkout Source" if: ${{ github.repository_owner == 'puppetlabs' }} uses: actions/checkout@v2 @@ -36,7 +34,7 @@ jobs: persist-credentials: false - name: "PDK Release prep" - uses: docker://puppet/pdk:nightly + uses: docker://puppet/iac_release:ci with: args: 'release prep --force' env: @@ -46,12 +44,18 @@ jobs: if: ${{ github.repository_owner == 'puppetlabs' }} id: gv run: | - echo "::set-output name=ver::$(cat metadata.json | jq .version | tr -d \")" + echo "::set-output name=ver::$(jq --raw-output .version metadata.json)" - - name: "Commit changes" + - name: "Check if a release is necessary" if: ${{ github.repository_owner == 'puppetlabs' }} + id: check + run: | + git diff --quiet CHANGELOG.md && echo "::set-output name=release::false" || echo "::set-output name=release::true" + + - name: "Commit changes" + if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} run: | - git config --local user.email "action@github.com" + git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com" git config --local user.name "GitHub Action" git add . git commit -m "Release prep v${{ steps.gv.outputs.ver }}" @@ -59,22 +63,27 @@ jobs: - name: Create Pull Request id: cpr uses: puppetlabs/peter-evans-create-pull-request@v3 - if: ${{ github.repository_owner == 'puppetlabs' }} + if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "Release prep v${{ steps.gv.outputs.ver }}" branch: "release-prep" delete-branch: true title: "Release prep v${{ steps.gv.outputs.ver }}" - body: "Automated release-prep through [pdk-templates](https://github.com/puppetlabs/pdk-templates/blob/main/moduleroot/.github/workflows/auto_release.yml.erb)" + 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" - name: PR outputs - if: ${{ github.repository_owner == 'puppetlabs' }} + if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} run: | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" - + - name: "Honeycomb: Record finish step" if: ${{ always() }} run: |