Release: Code freeze #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Release: Code freeze' | |
on: | |
schedule: | |
- cron: '0 0 * * 4' # Run at start of day UTC on Thursday. i.e. ~Wednesday EOD 23:59:59 UTC | |
workflow_dispatch: | |
inputs: | |
timeOverride: | |
description: "Time Override: The time to use in checking whether the action should run (default: 'now')." | |
default: 'now' | |
skipSlackPing: | |
description: 'Skip Slack Ping: If true, the Slack ping will be skipped (useful for testing)' | |
type: boolean | |
slackChannelOverride: | |
description: 'Slack Channel Override: The channel ID to send the Slack ping about the freeze' | |
env: | |
TIME_OVERRIDE: ${{ inputs.timeOverride || 'now' }} | |
GIT_COMMITTER_NAME: 'WooCommerce Bot' | |
GIT_COMMITTER_EMAIL: '[email protected]' | |
GIT_AUTHOR_NAME: 'WooCommerce Bot' | |
GIT_AUTHOR_EMAIL: '[email protected]' | |
permissions: {} | |
jobs: | |
code-freeze-prep: | |
name: 'Verify that today is the day of the code freeze and prepare repository' | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
outputs: | |
isTodayAcceleratedFreeze: ${{ steps.get-versions.outputs.isTodayAcceleratedFreeze }} | |
isTodayMonthlyFreeze: ${{ steps.get-versions.outputs.isTodayMonthlyFreeze }} | |
acceleratedVersion: ${{ steps.get-versions.outputs.acceleratedVersion }} | |
monthlyVersion: ${{ steps.get-versions.outputs.monthlyVersion }} | |
monthlyVersionXY: ${{ steps.get-versions.outputs.monthlyVersionXY }} | |
releasesFrozenToday: ${{ steps.get-versions.outputs.releasesFrozenToday }} | |
acceleratedBranch: ${{ steps.get-versions.outputs.acceleratedBranch }} | |
monthlyBranch: ${{ steps.get-versions.outputs.monthlyBranch }} | |
monthlyMilestone: ${{ steps.get-versions.outputs.monthlyMilestone }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup PNPM | |
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d | |
- name: Setup Node | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install prerequisites | |
run: | | |
pnpm install --filter monorepo-utils --ignore-scripts | |
# ignore scripts speeds up setup signficantly, but we still need to build monorepo utils | |
pnpm build | |
working-directory: tools/monorepo-utils | |
- name: 'Get the versions for the accelerated and monthly releases' | |
id: get-versions | |
run: pnpm utils code-freeze get-version -o $TIME_OVERRIDE | |
- name: Create next monthly milestone | |
id: milestone | |
if: steps.get-versions.outputs.isTodayMonthlyFreeze == 'yes' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: pnpm utils code-freeze milestone -o ${{ github.repository_owner }} -m ${{ steps.get-versions.outputs.monthlyMilestone }} | |
- name: Create next monthly release branch | |
id: branch | |
if: steps.get-versions.outputs.isTodayMonthlyFreeze == 'yes' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: pnpm utils code-freeze branch -o ${{ github.repository_owner }} -b ${{ steps.get-versions.outputs.monthlyBranch }} | |
- name: Create next accelerated release branch | |
id: branch-accel | |
if: steps.get-versions.outputs.isTodayAcceleratedFreeze == 'yes' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: pnpm utils code-freeze branch -o ${{ github.repository_owner }} -b ${{ steps.get-versions.outputs.acceleratedBranch }} | |
- name: Bump versions for Beta.1 monthly release | |
id: version-bump | |
if: steps.get-versions.outputs.isTodayMonthlyFreeze == 'yes' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: pnpm utils code-freeze version-bump -o ${{ github.repository_owner }} -b ${{ steps.get-versions.outputs.monthlyBranch }} -c ${{ steps.get-versions.outputs.monthlyVersion }}-beta.1 | |
- name: Bump versions for accelerated release | |
id: version-bump-accel | |
if: steps.get-versions.outputs.isTodayAcceleratedFreeze == 'yes' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: pnpm utils code-freeze version-bump -o ${{ github.repository_owner }} -b ${{ steps.get-versions.outputs.acceleratedBranch }} -c ${{ steps.get-versions.outputs.acceleratedVersion }} -af | |
- name: Prep accelerated release | |
id: accel-release-prep | |
if: steps.get-versions.outputs.isTodayAcceleratedFreeze == 'yes' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: pnpm utils code-freeze accelerated-prep -o ${{ github.repository_owner }} -b ${{ steps.get-versions.outputs.acceleratedBranch }} -c ${{ steps.get-versions.outputs.acceleratedVersion }} ${{ steps.get-versions.outputs.acceleratedReleaseDate }} | |
- name: Prepare trunk for next development cycle | |
id: prep-trunk | |
if: steps.get-versions.outputs.isTodayMonthlyFreeze == 'yes' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: pnpm utils code-freeze version-bump ${{ steps.get-versions.outputs.monthlyMilestone }}-dev -o ${{ github.repository_owner }} | |
- name: Generate changelog changes | |
id: changelog | |
if: steps.get-versions.outputs.isTodayMonthlyFreeze == 'yes' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: pnpm utils code-freeze changelog -c -o ${{ github.repository_owner }} -v ${{ steps.get-versions.outputs.monthlyVersionXY }} | |
notify-slack: | |
name: 'Sends code freeze notification to Slack' | |
runs-on: ubuntu-20.04 | |
needs: code-freeze-prep | |
if: ${{ inputs.skipSlackPing != true && ( needs.code-freeze-prep.outputs.isTodayAcceleratedFreeze == 'yes' || needs.code-freeze-prep.outputs.isTodayMonthlyFreeze == 'yes' ) }} | |
outputs: | |
ts: ${{ steps.notify.outputs.ts }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup PNPM | |
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d | |
- name: Setup Node | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install prerequisites | |
run: | | |
pnpm install --filter monorepo-utils --ignore-scripts | |
# ignore scripts speeds up setup signficantly, but we still need to build monorepo utils | |
pnpm build | |
working-directory: tools/monorepo-utils | |
- name: Slack | |
id: notify | |
run: | | |
pnpm utils slack "${{ secrets.CODE_FREEZE_BOT_TOKEN }}" " | |
:warning-8c: ${{ join( fromJSON( needs.code-freeze-prep.outputs.releasesFrozenToday ), ' and ' ) }} Code Freeze :ice_cube: | |
The freeze automation for ${{ join( fromJSON( needs.code-freeze-prep.outputs.releasesFrozenToday ), ' and ' ) }} has finished. ${{ ( needs.code-freeze-prep.outputs.isTodayMonthlyFreeze == 'yes' && 'If you need to request a code freeze exception, see the <' ) || '' }}${{ ( needs.code-freeze-prep.outputs.isTodayMonthlyFreeze == 'yes' && secrets.FG_LINK ) || '' }}${{ ( needs.code-freeze-prep.outputs.isTodayMonthlyFreeze == 'yes' && '/code-freeze-for-woocommerce-core-release/|fieldguide page for the code freeze>.' ) || '' }} | |
The build for ${{ join( fromJSON( needs.code-freeze-prep.outputs.releasesFrozenToday ), ' and ' ) }} will appear in this thread shortly... :thread: | |
" "${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_CHANNEL }}" | |
build-monthly: | |
name: Build beta zip file | |
runs-on: ubuntu-20.04 | |
needs: code-freeze-prep | |
if: ${{ needs.code-freeze-prep.outputs.isTodayMonthlyFreeze == 'yes' }} | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.code-freeze-prep.outputs.monthlyBranch }} | |
- name: Setup WooCommerce Monorepo | |
uses: ./.github/actions/setup-woocommerce-monorepo | |
with: | |
pull-package-deps: '@woocommerce/plugin-woocommerce' | |
- name: Build zip | |
working-directory: plugins/woocommerce | |
run: bash bin/build-zip.sh | |
- name: Upload the zip file as an artifact | |
uses: actions/upload-artifact@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: double-zipped-woocommerce.${{ needs.code-freeze-prep.outputs.monthlyVersion }}-beta.1 | |
path: plugins/woocommerce/woocommerce.zip | |
retention-days: 2 | |
build-a: | |
name: Build accelerated zip file | |
runs-on: ubuntu-20.04 | |
needs: code-freeze-prep | |
if: ${{ needs.code-freeze-prep.outputs.isTodayAcceleratedFreeze == 'yes' }} | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.code-freeze-prep.outputs.acceleratedBranch }} | |
- name: Setup WooCommerce Monorepo | |
uses: ./.github/actions/setup-woocommerce-monorepo | |
with: | |
pull-package-deps: '@woocommerce/plugin-woocommerce' | |
- name: Build zip | |
working-directory: plugins/woocommerce | |
run: bash bin/build-zip.sh | |
- name: Upload the zip file as an artifact | |
uses: actions/upload-artifact@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: double-zipped-woocommerce.${{ needs.code-freeze-prep.outputs.acceleratedVersion }} | |
path: plugins/woocommerce/woocommerce.zip | |
retention-days: 2 | |
r2-upload-monthly: | |
name: Upload Beta to R2 | |
runs-on: ubuntu-20.04 | |
needs: [ code-freeze-prep, build-monthly ] | |
if: ${{ needs.code-freeze-prep.outputs.isTodayMonthlyFreeze == 'yes' }} | |
steps: | |
- id: download | |
uses: actions/download-artifact@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: double-zipped-woocommerce.${{ needs.code-freeze-prep.outputs.monthlyVersion }}-beta.1 | |
path: download | |
- run: ls -lah ${{steps.download.outputs.download-path}} | |
- name: Upload release zip to Cloudflare R2 bucket | |
uses: ryand56/r2-upload-action@de3eabc2e3137ce07bc3805af441df55f535c64b | |
with: | |
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} | |
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} | |
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
r2-bucket: ${{ secrets.R2_BUCKET }} | |
source-dir: ${{ steps.download.outputs.download-path }} | |
destination-dir: ./monthly/ | |
slack-upload-monthly: | |
name: Upload Beta to Slack | |
runs-on: ubuntu-20.04 | |
needs: [ code-freeze-prep, notify-slack, build-monthly ] | |
if: ${{ needs.code-freeze-prep.outputs.isTodayMonthlyFreeze == 'yes' && inputs.skipSlackPing != true }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup PNPM | |
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d | |
- name: Setup Node | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install prerequisites | |
run: | | |
pnpm install --filter monorepo-utils --ignore-scripts | |
# ignore scripts speeds up setup signficantly, but we still need to build monorepo utils | |
pnpm build | |
working-directory: tools/monorepo-utils | |
- id: download | |
uses: actions/download-artifact@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: double-zipped-woocommerce.${{ needs.code-freeze-prep.outputs.monthlyVersion }}-beta.1 | |
path: download | |
- run: ls -lah ${{steps.download.outputs.download-path}} | |
- name: Send release zip to Slack | |
id: send-file-slack | |
run : | | |
pnpm utils slack file "${{ secrets.CODE_FREEZE_BOT_TOKEN }}" "Here's the generated release build for ${{ needs.code-freeze-prep.outputs.monthlyVersion }}-beta.1" "${{ steps.download.outputs.download-path }}/woocommerce.zip" "${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_CHANNEL }}" --reply-ts ${{ needs.notify-slack.outputs.ts }} --filename "woocommerce.${{ needs.code-freeze-prep.outputs.monthlyVersion }}-beta.1.zip" | |
r2-upload-accelerated: | |
name: Upload Accelerated to R2 | |
runs-on: ubuntu-20.04 | |
needs: [ code-freeze-prep, build-a ] | |
if: ${{ needs.code-freeze-prep.outputs.isTodayAcceleratedFreeze == 'yes' }} | |
steps: | |
- id: download | |
uses: actions/download-artifact@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: double-zipped-woocommerce.${{ needs.code-freeze-prep.outputs.acceleratedVersion }} | |
path: download | |
- run: ls -lah ${{steps.download.outputs.download-path}} | |
- name: Upload release zip to Cloudflare R2 bucket | |
uses: ryand56/r2-upload-action@de3eabc2e3137ce07bc3805af441df55f535c64b | |
with: | |
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} | |
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} | |
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
r2-bucket: ${{ secrets.R2_BUCKET }} | |
source-dir: ${{ steps.download.outputs.download-path }} | |
destination-dir: ./accelerated/ | |
slack-upload-accelerated: | |
name: Upload Accelerated to Slack | |
runs-on: ubuntu-20.04 | |
needs: [ code-freeze-prep, notify-slack, build-a ] | |
if: ${{ needs.code-freeze-prep.outputs.isTodayAcceleratedFreeze == 'yes' && inputs.skipSlackPing != true }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup PNPM | |
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d | |
- name: Setup Node | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c | |
with: | |
node-version-file: .nvmrc | |
cache: pnpm | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install prerequisites | |
run: | | |
pnpm install --filter monorepo-utils --ignore-scripts | |
# ignore scripts speeds up setup signficantly, but we still need to build monorepo utils | |
pnpm build | |
working-directory: tools/monorepo-utils | |
- id: download | |
uses: actions/download-artifact@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: double-zipped-woocommerce.${{ needs.code-freeze-prep.outputs.acceleratedVersion }} | |
path: download | |
- run: ls -lah ${{steps.download.outputs.download-path}} | |
- name: Send release zip to Slack | |
id: send-file-slack | |
run : | | |
pnpm utils slack file "${{ secrets.CODE_FREEZE_BOT_TOKEN }}" "Here's the generated release build for ${{ needs.code-freeze-prep.outputs.acceleratedVersion }}" "${{ steps.download.outputs.download-path }}/woocommerce.zip" "${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_CHANNEL }}" --reply-ts ${{ needs.notify-slack.outputs.ts }} --filename "woocommerce.${{ needs.code-freeze-prep.outputs.acceleratedVersion }}.zip" | |
github-upload-monthly: | |
name: Create single-zipped GitHub asset (Monthly) | |
runs-on: ubuntu-20.04 | |
needs: [ code-freeze-prep, build-monthly ] | |
if: ${{ needs.code-freeze-prep.outputs.isTodayMonthlyFreeze == 'yes' }} | |
steps: | |
- id: download | |
uses: actions/download-artifact@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: double-zipped-woocommerce.${{ needs.code-freeze-prep.outputs.monthlyVersion }}-beta.1 | |
path: download | |
- name: Unzip the file (prevents double zip problem) | |
run: unzip ${{ steps.download.outputs.download-path }}/woocommerce.zip -d zipfile | |
- name: Upload the zip file as an artifact | |
uses: actions/upload-artifact@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: woocommerce.${{ needs.code-freeze-prep.outputs.monthlyVersion }}-beta.1 | |
path: zipfile | |
retention-days: 10 | |
github-upload-accelerated: | |
name: Create single-zipped GitHub asset (Accelerated) | |
runs-on: ubuntu-20.04 | |
needs: [ code-freeze-prep, build-a ] | |
if: ${{ needs.code-freeze-prep.outputs.isTodayAcceleratedFreeze == 'yes' }} | |
steps: | |
- id: download | |
uses: actions/download-artifact@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: double-zipped-woocommerce.${{ needs.code-freeze-prep.outputs.acceleratedVersion }} | |
path: download | |
- name: Unzip the file (prevents double zip problem) | |
run: unzip ${{ steps.download.outputs.download-path }}/woocommerce.zip -d zipfile | |
- name: Upload the zip file as an artifact | |
uses: actions/upload-artifact@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: woocommerce.${{ needs.code-freeze-prep.outputs.acceleratedVersion }} | |
path: zipfile | |
retention-days: 10 |