Skip to content

Commit 38fe12d

Browse files
authored
Merge pull request #1565 from forcedotcom/d/W-16362588-v4
NEW (CodeAnalyzer) @W-16362588@ Release branch creation now triggers v5 equivalent too.
2 parents b0c9d7f + 73c07b2 commit 38fe12d

File tree

2 files changed

+63
-28
lines changed

2 files changed

+63
-28
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: automated-release-tasks
2+
on:
3+
schedule:
4+
# Cron syntax is "minute[0-59] hour[0-23] date[1-31] month[1-12] day[0-6]". '*' is 'any value,' and multiple values
5+
# can be specified with comma-separated lists. All times are UTC.
6+
# So this expression means "run at 12 PM UTC, every Friday".
7+
- cron: "0 12 * * 5"
8+
9+
10+
jobs:
11+
# Depending on circumstances, we may want to exit early instead of running the workflow to completion.
12+
verify-should-run:
13+
runs-on: macos-latest
14+
outputs:
15+
should-run: ${{ steps.main.outputs.should_run }}
16+
steps:
17+
- id: main
18+
run: |
19+
# `date -u` returns UTC datetime, and `%u` formats the output to be the day of the week, with 1 being Monday,
20+
# 2 being Tuesday, etc.
21+
TODAY_DOW=$(date -u +%u)
22+
# This `date` expression returns the last Tuesday of the month, which is our Release Day. %d formats the output
23+
# as the day of the month (1-31).
24+
NEXT_RELEASE_DATE=$(date -u -v1d -v+1m -v-1d -v-tue +%d)
25+
# This `date` expression returns next Tuesday, and `%d` formats the output as the day of the month (1-31).
26+
NEXT_TUESDAY_DATE=$(date -u -v+tue +%d)
27+
# This workflow should only be allowed to run to completion on the Friday before Release Day.
28+
[[ $TODAY_DOW != 5 || $NEXT_RELEASE_DATE != $NEXT_TUESDAY_DATE ]] && echo "should_run=false" >> "$GITHUB_OUTPUT" || echo "should_run=true" >> "$GITHUB_OUTPUT"
29+
create-alpha-release-branch:
30+
runs-on: macos-latest
31+
needs: verify-should-run
32+
if: ${{ needs.verify-should-run.outputs.should-run == 'true' }}
33+
steps:
34+
- name: Invoke alpha workflow
35+
uses: actions/github-script@v6
36+
with:
37+
github-token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }}
38+
script: |
39+
await github.rest.actions.createWorkflowDispatch({
40+
owner: context.repo.owner,
41+
repo: context.repo.repo,
42+
workflow_id: 'create-release-branch.yml',
43+
ref: 'dev-5'
44+
});
45+
create-release-branch:
46+
runs-on: macos-latest
47+
needs: verify-should-run
48+
if: ${{ needs.verify-should-run.outputs.should-run == 'true' }}
49+
steps:
50+
- name: Invoke GA workflow
51+
uses: actions/github-script@v6
52+
with:
53+
github-token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }}
54+
script: |
55+
await github.rest.actions.createWorkflowDispatch({
56+
owner: context.repo.owner,
57+
repo: context.repo.repo,
58+
workflow_id: 'create-release-branch.yml',
59+
ref: 'dev',
60+
inputs: {
61+
"release-type": "minor"
62+
}
63+
});

.github/workflows/create-release-branch.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,10 @@ on:
1212
- minor
1313
- patch
1414
required: true
15-
schedule:
16-
# Cron syntax is "minute[0-59] hour[0-23] date[1-31] month[1-12] day[0-6]". '*' is 'any value,' and multiple values
17-
# can be specified with comma-separated lists. All times are UTC.
18-
# So this expression means "run at 12 PM UTC, every Friday".
19-
- cron: "0 12 * * 5"
2015

2116
jobs:
22-
# Depending on circumstances, we may want to exit early instead of running the workflow to completion.
23-
verify-should-run:
24-
runs-on: macos-latest
25-
outputs:
26-
should-run: ${{ steps.main.outputs.should_run }}
27-
steps:
28-
- id: main
29-
run: |
30-
# If the workflow was manually triggered, then it should always be allowed to run to completion.
31-
[[ "${{ github.event_name }}" = "workflow_dispatch" ]] && echo "should_run=true" >> "$GITHUB_OUTPUT" && exit 0
32-
# `date -u` returns UTC datetime, and `%u` formats the output to be the day of the week, with 1 being Monday,
33-
# 2 being Tuesday, etc.
34-
TODAY_DOW=$(date -u +%u)
35-
# This `date` expression returns the last Tuesday of the month, which is our Release Day. %d formats the output
36-
# as the day of the month (1-31).
37-
NEXT_RELEASE_DATE=$(date -u -v1d -v+1m -v-1d -v-tue +%d)
38-
# This `date` expression returns next Tuesday, and `%d` formats the output as the day of the month (1-31).
39-
NEXT_TUESDAY_DATE=$(date -u -v+tue +%d)
40-
# If the workflow wasn't manually triggered, then it should only be allowed to run to completion on the Friday
41-
# before Release Day.
42-
[[ $TODAY_DOW != 5 || $NEXT_RELEASE_DATE != $NEXT_TUESDAY_DATE ]] && echo "should_run=false" >> "$GITHUB_OUTPUT" || echo "should_run=true" >> "$GITHUB_OUTPUT"
4317
create-release-branch:
4418
runs-on: macos-latest
45-
needs: verify-should-run
46-
if: ${{ needs.verify-should-run.outputs.should-run == 'true' }}
4719
env:
4820
GH_TOKEN: ${{ github.token }}
4921
permissions:

0 commit comments

Comments
 (0)