-
Notifications
You must be signed in to change notification settings - Fork 3.9k
70 lines (61 loc) · 2.39 KB
/
prepare-cloud-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: "Prepare Cloud Release"
on:
workflow_dispatch:
# Triggers the workflow every work day at 8:00 UTC
# The 3 hour offset should change when daylight savings change for GMT +3.
schedule:
- cron: "0 9 * * 1,2,3,4,5"
jobs:
daily-release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
timeout-minutes: 10
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set output variables
id: output-variables
run: |
echo "::set-output name=date_humanized::$(date +'%Y-%m-%d %H:%M')"
echo "::set-output name=branch_name::release_$(date +'%Y_%m_%d_%H_%M')"
- name: Create Novu Cloud release branch
run: git checkout -b ${{ steps.output-variables.outputs.branch_name }}
- name: Push release branch
run: git push origin ${{ steps.output-variables.outputs.branch_name }}
- name: Create Novu Cloud release PR
run: |
gh pr create --base prod --head ${{ steps.output-variables.outputs.branch_name }} --title "Release ${{ steps.output-variables.outputs.date_humanized }}" --body "Automated daily production Novu Cloud release"
- name: Enable PR automerge
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ steps.open-pr.outputs.pr_number }}
merge-method: merge
- name: Generate commit log
id: commit-log
run: |
echo 'COMMIT_LOG<<EOF' >> $GITHUB_ENV
echo $(git log --format="format:%h %s (@%aL)\n" origin/prod..origin/${{ steps.output-variables.outputs.branch_name }} | sed "s/\"/'/g") >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Send commit log to Slack
id: slack
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*<${{steps.open-pr.outputs.pr_url}}|Novu Cloud Release: ${{ steps.output-variables.outputs.date_humanized }}>*\n```${{ env.COMMIT_LOG }}```"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_ENG_FEED_DEPLOYMENTS }}