Skip to content

Daily Hosting Release #62

Daily Hosting Release

Daily Hosting Release #62

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_AUTOMATED_RELEASE: ${{ env.LAST_AUTOMATED_RELEASE }}
- 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' && ${{ github.EVENT_NAME }} == 'schedule'
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 +%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 }}"
}
}
]
}