forked from elementor/elementor
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (146 loc) · 5.35 KB
/
daily-hosting-release.yml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Daily Hosting Release
env:
CHANNEL: 'cloud'
CHANGELOG_FILE: 'temp-changelog.txt'
on:
schedule:
- cron: '0 10 * * *'
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-22.04
steps:
- name: checkout branch
uses: actions/checkout@v3
# Only run on main branch
if: ${{ github.ref == 'refs/heads/main' }}
with:
ref: ${{ github.ref }}
- name: Get Configuration
id: configuration
uses: maork-elementor/json-to-variables@main
with:
filename: './.github/workflows/config.json'
prefix: config
- name: Test permissions
uses: ./.github/workflows/permissions
with:
ENVIRONMENT: ${{ env.config_deployment_environment }}
DEPLOYMENT_PERMITTED: ${{ env.config_deployment_permitted }}
DEPLOYMENT_REPOSITORY_OWNER: ${{ env.config_deployment_repository_owner }}
- name: Install Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Env Vars Configure
uses: ./.github/workflows/env-vars-configure
with:
CHANNEL: ${{ env.CHANNEL }}
REF: ${{ github.ref }}
# - name: Check if two weeks have passed since last release
# uses: ./.github/workflows/bi-weekly-release
# with:
# CHANNEL: ${{ env.CHANNEL }}
# LAST_RELEASE_DATE: ${{ env.LAST_RELEASE_DATE }}
- name: Bump Channel Version
uses: ./.github/workflows/bump-channel-version
with:
CLEAN_PACKAGE_VERSION: ${{ env.CLEAN_PACKAGE_VERSION }}
CHANNEL: ${{ env.CHANNEL }}
OVERRIDE_PACKAGE_VERSION: true
- name: Install Dependencies
run: |
npm ci
- name: Install Octokit
# if: ${{ env.CHANNEL == 'cloud' && }}
run: npm install octokit@2.0.19
- name: Set Oktokit env variables
run: |
REPOSITORY_ID=${{ github.repository_id }}
EVENT_NAME=${{ github.event_name }}
CURRENT_DATE=$(date -u +"%Y-%m-%d %H:%M:%S")
echo "REPOSITORY_ID=$REPOSITORY_ID" >> $GITHUB_ENV
echo "EVENT_NAME=$EVENT_NAME" >> $GITHUB_ENV
echo "CURRENT_DATE=$CURRENT_DATE" >> $GITHUB_ENV
- name: Set release date env variable
uses: ./.github/workflows/set-last-automated-release-date
with:
REPOSITORY_ID: ${{ env.REPOSITORY_ID }}
ENVIRONMENT_NAME: 'SCHEDULE_RELEASES'
CHANNEL: ${{ env.CHANNEL }}
NAME: 'LAST_AUTOMATED_RELEASE'
MAINTAIN_TOKEN: ${{ secrets.LOCAL_MANTAIN_TOKEN }} #Replace with ${{ secrets.MAINTAIN_TOKEN }}
VALUE: ${{ env.CURRENT_DATE }}
- name: Build plugin
uses: ./.github/workflows/build-plugin
with:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
BUILD_SCRIPT_PATH: "./.github/scripts/build-zip.sh"
- name: Generate changelog
uses : ./.github/workflows/generate-changelog
with:
TOKEN: ${{ secrets.MAINTAIN_TOKEN }}
REPOSITORY: ${{ github.repository }}
HEAD_BRANCH_NAME: ${{ github.ref }}
BASE_TAG_NAME: ${{ env.PREVIOUS_TAG_SHA }}
GENERATE_EMPTY_CHANGELOG: true
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.PACKAGE_VERSION }}
target_commitish: ${{ env.CLEAN_REF }}
files: |
elementor-*.zip
${{ env.CHANGELOG_FILE }}
# Will be removed once we see that the release is working
prerelease: true
body_path: ${{ env.CHANGELOG_FILE }}
# Place Oktokit execution here
- name: Post To Slack Created Cloud daily Release
uses : ./.github/workflows/post-to-slack
with:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }}
SLACK_TAG_CHANNELS: ${{ secrets.SLACK_CHANNEL_RELEASEBOT }}
PAYLOAD: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hi All :smile:\n\nWe just Published Could daily release of *Elementor*\n`${{ env.PACKAGE_VERSION }}`"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Tag *${{ env.PACKAGE_VERSION }}* \nCreated by ${{ github.actor }}"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "Open :point_left:",
"emoji": true
},
"value": "open-release",
"url": "https://github.com/${{ github.repository }}/releases/tag/${{ env.PACKAGE_VERSION }}",
"action_id": "button-action"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*v${{ env.PACKAGE_VERSION }} Changelog* \n\n ${{ env.CHANGELOG_CONTENT }}"
}
}
]
}