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