Skip to content

Commit 8e12a83

Browse files
author
Sophie Wigmore
committed
Add release reminder workflow
1 parent f97e6fe commit 8e12a83

File tree

1 file changed

+98
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)