name: 'Release: Code freeze' on: schedule: - cron: '0 23 * * 1' # Run at 2300 UTC on Mondays. 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: 'no-reply@woocommerce.com' GIT_AUTHOR_NAME: 'WooCommerce Bot' GIT_AUTHOR_EMAIL: 'no-reply@woocommerce.com' 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: freeze: ${{ steps.check-freeze.outputs.freeze }} nextReleaseBranch: ${{ steps.branch.outputs.nextReleaseBranch }} nextReleaseVersion: ${{ steps.milestone.outputs.nextReleaseVersion }} nextDevelopmentVersion: ${{ steps.milestone.outputs.nextDevelopmentVersion }} steps: - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 - name: Install prerequisites run: | npm install -g pnpm pnpm install --filter monorepo-utils - name: 'Check whether today is the code freeze day' id: check-freeze run: pnpm utils code-freeze verify-day -o $TIME_OVERRIDE - name: Create next milestone id: milestone if: steps.check-freeze.outputs.freeze == 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: pnpm run utils code-freeze milestone -o ${{ github.repository_owner }} - name: Create next release branch id: branch if: steps.check-freeze.outputs.freeze == 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: pnpm run utils code-freeze branch -o ${{ github.repository_owner }} - name: Prepare trunk for next development cycle id: prep-trunk if: steps.check-freeze.outputs.freeze == 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: pnpm run utils code-freeze version-bump -o ${{ github.repository_owner }} -v ${{ steps.milestone.outputs.nextDevelopmentVersion }}.0-dev notify-slack: name: 'Sends code freeze notification to Slack' runs-on: ubuntu-20.04 needs: code-freeze-prep if: ${{ needs.code-freeze-prep.outputs.freeze == 'true' && inputs.skipSlackPing != true }} 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.code-freeze-prep.outputs.nextReleaseVersion }} Code Freeze :ice_cube: The automation to cut the release branch for ${{ needs.code-freeze-prep.outputs.nextReleaseVersion }} has run. Any PRs that were not already merged will be a part of ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.nextDevelopmentVersion }} by default. If you have something that needs to make ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.nextReleaseVersion }} 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 permissions: actions: write needs: code-freeze-prep if: needs.code-freeze-prep.outputs.freeze == 'true' 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: { releaseVersion: "${{ needs.code-freeze-prep.outputs.nextReleaseVersion }}", releaseBranch: "${{ needs.code-freeze-prep.outputs.nextReleaseBranch }}" } })