|
| 1 | +name: Release Reminder |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 0 * * 4' # Run at midnight on Thursdays |
| 6 | + workflow_dispatch: {} |
| 7 | + |
| 8 | +jobs: |
| 9 | + determine-date: |
| 10 | + name: Release buildpacks on 2nd and last Thursdays of the month |
| 11 | + runs-on: ubuntu-22.04 |
| 12 | + outputs: |
| 13 | + should_run: ${{ steps.should_run.outputs.bool }} |
| 14 | + steps: |
| 15 | + - name: Should run |
| 16 | + id: should_run |
| 17 | + run: | |
| 18 | + if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then |
| 19 | + echo "Skipping date check, because workflow was run manually" |
| 20 | + echo "bool=true" >> "${GITHUB_OUTPUT}" |
| 21 | + else |
| 22 | + day_of_month=$(date +%d) |
| 23 | + last_day_cutoff=$(expr $(date -d "-$(date +%d) days month" +%d) - 6) |
| 24 | + # Check if it's the second or last Thursday of the month |
| 25 | + # second thursday of the month will always be between day 8 and 14 (inclusive) |
| 26 | + if [[ "$day_of_month" -ge "8" && "$day_of_month" -le "14" ]]; then |
| 27 | + echo "It's the second Thursday of the month" |
| 28 | + echo "bool=true" >> "${GITHUB_OUTPUT}" |
| 29 | + # last thursday of the month will always be within 6 days of the last day of the month |
| 30 | + # $last_day_cutoff=(# days in this month - 6) |
| 31 | + elif [[ "$day_of_month" -ge "$last_day_cutoff" ]]; then |
| 32 | + echo "It's the last Thursday of the month" |
| 33 | + echo "bool=true" >> "${GITHUB_OUTPUT}" |
| 34 | + else |
| 35 | + echo "It's another Thursday of the month" |
| 36 | + echo "bool=false" >> "${GITHUB_OUTPUT}" |
| 37 | + fi |
| 38 | + fi |
| 39 | + reminder: |
| 40 | + name: Reminder |
| 41 | + runs-on: ubuntu-22.04 |
| 42 | + needs: [ determine-date ] |
| 43 | + if: ${{ needs.determine-date.outputs.should_run == 'true' }} |
| 44 | + steps: |
| 45 | + - name: Get Date |
| 46 | + id: date |
| 47 | + run: | |
| 48 | + today=$(date +'%m-%d') |
| 49 | + window_close_date=$(date -d "+5 days" +'%m-%d') |
| 50 | +
|
| 51 | + echo "today=$today" >> "${GITHUB_OUTPUT}" |
| 52 | + echo "window_close_date=$window_close_date" >> "${GITHUB_OUTPUT}" |
| 53 | +
|
| 54 | + - name: Checkout |
| 55 | + uses: actions/checkout@v3 |
| 56 | + with: |
| 57 | + token: ${{ secrets.CF_BOT_GITHUB_TOKEN }} |
| 58 | + ref: develop |
| 59 | + fetch-depth: 0 |
| 60 | + |
| 61 | + - name: Get Latest Version |
| 62 | + id: latest-version |
| 63 | + run: | |
| 64 | + echo "val=$(git describe --abbrev=0 --tag)" >> "${GITHUB_OUTPUT}" |
| 65 | +
|
| 66 | + - name: PHP specific task |
| 67 | + id: php-specific |
| 68 | + if: github.repository == 'cloudfoundry/php-buildpack' |
| 69 | + run: | |
| 70 | + echo 'task=* Bump PHP modules. See [doc](https://github.com/cloudfoundry/buildpacks-ci/tree/master/scripts/php-modules#pre-buildpack-release-task)' >> "${GITHUB_OUTPUT}" |
| 71 | + echo 'title=Bump PHP Modules and ' >> "${GITHUB_OUTPUT}" |
| 72 | +
|
| 73 | + - name: File Issue |
| 74 | + id: file-issue |
| 75 | + uses: paketo-buildpacks/github-config/actions/issue/file@main |
| 76 | + with: |
| 77 | + token: ${{ secrets.CF_BOT_GITHUB_TOKEN }} |
| 78 | + repo: ${{ github.repository }} |
| 79 | + issue_title: "${{ steps.php-specific.outputs.title }}Release: ${{ github.event.repository.name }} (${{ steps.date.outputs.today }})" |
| 80 | + issue_body: | |
| 81 | + Release reminder for ${{ github.event.repository.name }} |
| 82 | +
|
| 83 | + The ideal release date window for this buildpack starts on: ${{ steps.date.outputs.today }} and ends on ${{ steps.date.outputs.window_close_date }}. |
| 84 | +
|
| 85 | + ${{ steps.php-specific.outputs.task }} |
| 86 | + * See [diff from latest version]("https://github.com/${{ github.repository }}/compare/${{ steps.latest-version.outputs.val }}..develop") and validate if a release is required. |
| 87 | + * Make sure the latest commit on `develop` has passed tests on the [CI](https://buildpacks.ci.cf-app.com/teams/main/pipelines/${{ github.event.repository.name }}) |
| 88 | + * Refer [release instructions](https://github.com/pivotal-cf/tanzu-buildpacks/wiki/Releasing-CF-Buildpacks). (private link) |
| 89 | +
|
| 90 | + - name: Add issue to project |
| 91 | + id: issue-to-proj |
| 92 | + uses: paketo-buildpacks/github-config/actions/issue/add-to-project@main |
| 93 | + with: |
| 94 | + # CF buildpacks project - https://github.com/orgs/cloudfoundry/projects/37 |
| 95 | + project-org: cloudfoundry |
| 96 | + project-num: 37 |
| 97 | + field-name: Workstream |
| 98 | + option-name: Release Train |
| 99 | + issue-node-id: ${{ steps.file-issue.outputs.node-id }} |
| 100 | + token: ${{ secrets.CF_BOT_GITHUB_TOKEN }} |
0 commit comments