2022-12-01 08:36:26 +00:00
name: 'Release : Code freeze'
2022-02-09 19:43:05 +00:00
on :
2022-12-01 08:36:26 +00:00
schedule :
2022-12-20 16:51:41 +00:00
- cron : '0 23 * * 1' # Run at 2300 UTC on Mondays.
2022-12-01 08:36:26 +00:00
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'
2022-06-16 19:44:07 +00:00
env :
2023-04-19 19:07:54 +00:00
TIME_OVERRIDE : ${{ inputs.timeOverride || 'now' }}
2022-10-13 18:23:03 +00:00
GIT_COMMITTER_NAME : 'WooCommerce Bot'
GIT_COMMITTER_EMAIL : 'no-reply@woocommerce.com'
GIT_AUTHOR_NAME : 'WooCommerce Bot'
GIT_AUTHOR_EMAIL : 'no-reply@woocommerce.com'
2022-02-09 19:43:05 +00:00
2023-01-02 17:28:11 +00:00
permissions : {}
2022-02-09 19:43:05 +00:00
jobs :
2022-12-01 08:36:26 +00:00
verify-code-freeze :
name : 'Verify that today is the day of the code freeze'
runs-on : ubuntu-20.04
outputs :
freeze : ${{ steps.check-freeze.outputs.freeze }}
steps :
2023-04-12 21:28:53 +00:00
- name : Checkout code
uses : actions/checkout@v3
2022-12-01 08:36:26 +00:00
with :
2023-04-12 21:28:53 +00:00
fetch-depth : 0
2022-12-01 08:36:26 +00:00
2023-04-12 21:28:53 +00:00
- name : Install prerequisites
2022-12-01 08:36:26 +00:00
run : |
2023-04-12 21:28:53 +00:00
npm install -g pnpm@7
pnpm install --filter monorepo-utils
2022-12-01 08:36:26 +00:00
2023-04-12 21:28:53 +00:00
- name : 'Check whether today is the code freeze day'
id : check-freeze
run : pnpm utils code-freeze verify-day -g -o $TIME_OVERRIDE
2022-12-01 08:36:26 +00:00
maybe-create-next-milestone-and-release-branch :
name : 'Maybe create next milestone and release branch'
runs-on : ubuntu-20.04
2023-01-02 17:28:11 +00:00
permissions :
2023-01-16 14:12:25 +00:00
contents : write
issues : write
2022-12-01 08:36:26 +00:00
needs : verify-code-freeze
2023-04-12 21:28:53 +00:00
if : needs.verify-code-freeze.outputs.freeze == 'true'
2022-12-01 08:36:26 +00:00
outputs :
branch : ${{ steps.freeze.outputs.branch }}
release_version : ${{ steps.freeze.outputs.release_version }}
next_version : ${{ steps.freeze.outputs.next_version }}
steps :
2023-04-12 21:28:53 +00:00
- name : 'Install PHP'
uses : shivammathur/setup-php@8e2ac35f639d3e794c1da1f28999385ab6fdf0fc
with :
php-version : '7.4'
2022-12-01 08:36:26 +00:00
- name : Checkout code
uses : actions/checkout@v3
with :
fetch-depth : 100
- name : Setup WooCommerce Monorepo
uses : ./.github/actions/setup-woocommerce-monorepo
with :
build : false
- name : 'Run the script to enforce the code freeze'
id : freeze
run : php .github/workflows/scripts/release-code-freeze.php
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
GITHUB_OUTPUTS : 1
prep-trunk :
name : Preps trunk for next development cycle
runs-on : ubuntu-20.04
2023-01-02 17:28:11 +00:00
permissions :
2023-01-16 14:12:25 +00:00
contents : write
pull-requests : write
2022-12-01 08:36:26 +00:00
needs : maybe-create-next-milestone-and-release-branch
steps :
- name : Checkout code
uses : actions/checkout@v3
with :
fetch-depth : 100
- name : fetch-trunk
run : git fetch origin trunk
- name : checkout-trunk
run : git checkout trunk
- name : Setup WooCommerce Monorepo
uses : ./.github/actions/setup-woocommerce-monorepo
- name : Create branch
run : git checkout -b prep/trunk-for-next-dev-cycle-${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }}
- name : Bump versions
working-directory : ./tools/version-bump
run : pnpm run version bump woocommerce -v ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }}.0-dev
- name : Checkout pnpm-lock.yaml to prevent issues
run : git checkout pnpm-lock.yaml
- name : Commit changes
run : git commit -am "Prep trunk for ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }} cycle"
- name : Push branch up
run : git push --no-verify origin prep/trunk-for-next-dev-cycle-${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }}
- name : Create the PR
uses : actions/github-script@v6
with :
script : |
const body = "This PR updates the versions in trunk to ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }} for next development cycle."
const pr = await github.rest.pulls.create({
owner : context.repo.owner,
repo : context.repo.repo,
title : "Prep trunk for ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }} cycle" ,
head : "prep/trunk-for-next-dev-cycle-${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }}" ,
base : "trunk" ,
body : body
})
notify-slack :
name : 'Sends code freeze notification to Slack'
if : ${{ inputs.skipSlackPing != true }}
runs-on : ubuntu-20.04
needs : maybe-create-next-milestone-and-release-branch
steps :
- name : Slack
uses : archive/github-actions-slack@v2.0.0
id : notify
with :
slack-bot-user-oauth-access-token : ${{ secrets.CODE_FREEZE_BOT_TOKEN }}
slack-channel : ${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_CHANNEL }}
slack-text : |
:warning-8c : ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.release_version }} Code Freeze :ice_cube:
The automation to cut the release branch for ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.release_version }} has run. Any PRs that were not already merged will be a part of ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }} by default. If you have something that needs to make ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.release_version }} that hasn't yet been merged, please see the <${{ secrets.FG_LINK }}/code-freeze-for-woocommerce-core-release/|fieldguide page for the code freeze>.
trigger-changelog-action :
name : 'Trigger changelog action'
runs-on : ubuntu-20.04
2023-01-02 17:28:11 +00:00
permissions :
2023-01-16 14:12:25 +00:00
actions : write
2022-12-01 08:36:26 +00:00
needs : maybe-create-next-milestone-and-release-branch
steps :
- name : 'Trigger changelog action'
uses : actions/github-script@v6
with :
script : |
github.rest.actions.createWorkflowDispatch({
owner : context.repo.owner,
repo : context.repo.repo,
workflow_id : 'release-changelog.yml' ,
ref : 'trunk' ,
inputs : {
2022-12-20 16:51:41 +00:00
releaseVersion : "${{ needs.maybe-create-next-milestone-and-release-branch.outputs.release_version }}" ,
releaseBranch : "${{ needs.maybe-create-next-milestone-and-release-branch.outputs.branch }}"
2022-12-01 08:36:26 +00:00
}
})