Remove some usages of set-output (#35799)
* Migrate straight script usage of set-output to write to GITHUB_OUTPUT * Use file_put_contents in php scripts to set GITHUB_OUTPUT
This commit is contained in:
parent
2c03d6cc82
commit
43143b848f
|
@ -2,69 +2,69 @@ name: Setup WooCommerce Monorepo
|
||||||
description: Handles the installation, building, and caching of the projects within the monorepo.
|
description: Handles the installation, building, and caching of the projects within the monorepo.
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
install-filters:
|
install-filters:
|
||||||
description: The PNPM filter used to decide what projects to install. Supports multiline strings for multiple filters.
|
description: The PNPM filter used to decide what projects to install. Supports multiline strings for multiple filters.
|
||||||
default: ""
|
default: ''
|
||||||
build:
|
build:
|
||||||
description: Indicates whether or not the action should build any projects.
|
description: Indicates whether or not the action should build any projects.
|
||||||
default: "true"
|
default: 'true'
|
||||||
build-filters:
|
build-filters:
|
||||||
description: The PNPM filter used to decide what projects to build. Supports multiline strings for multiple filters.
|
description: The PNPM filter used to decide what projects to build. Supports multiline strings for multiple filters.
|
||||||
default: ""
|
default: ''
|
||||||
php-version:
|
php-version:
|
||||||
description: The version of PHP that the action should set up.
|
description: The version of PHP that the action should set up.
|
||||||
default: "7.4"
|
default: '7.4'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Parse Action Input
|
- name: Parse Action Input
|
||||||
id: parse-input
|
id: parse-input
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=INSTALL_FILTERS::$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.install-filters }}')"
|
echo "INSTALL_FILTERS=$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.install-filters }}')" >> $GITHUB_OUTPUT
|
||||||
echo "::set-output name=BUILD_FILTERS::$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.build-filters }}')"
|
echo "BUILD_FILTERS=$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.build-filters }}')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Setup PNPM
|
||||||
uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d
|
uses: pnpm/action-setup@10693b3829bf86eb2572aef5f3571dcf5ca9287d
|
||||||
with:
|
with:
|
||||||
version: "^7.13.3"
|
version: '^7.13.3'
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93
|
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93
|
||||||
with:
|
with:
|
||||||
node-version-file: .nvmrc
|
node-version-file: .nvmrc
|
||||||
cache: pnpm
|
cache: pnpm
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@e04e1d97f0c0481c6e1ba40f8a538454fe5d7709
|
|
||||||
with:
|
|
||||||
php-version: ${{ inputs.php-version }}
|
|
||||||
coverage: none
|
|
||||||
tools: phpcs, sirbrillig/phpcs-changed
|
|
||||||
|
|
||||||
- name: Cache Composer Dependencies
|
- name: Setup PHP
|
||||||
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
|
uses: shivammathur/setup-php@e04e1d97f0c0481c6e1ba40f8a538454fe5d7709
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/composer/files
|
php-version: ${{ inputs.php-version }}
|
||||||
key: ${{ runner.os }}-php-${{ inputs.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
|
coverage: none
|
||||||
restore-keys: ${{ runner.os }}-php-${{ inputs.php-version }}-composer-
|
tools: phpcs, sirbrillig/phpcs-changed
|
||||||
|
|
||||||
- name: Install Node and PHP Dependencies
|
- name: Cache Composer Dependencies
|
||||||
shell: bash
|
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
|
||||||
run: |
|
with:
|
||||||
pnpm -w install turbo
|
path: ~/.cache/composer/files
|
||||||
pnpm install ${{ steps.parse-input.outputs.INSTALL_FILTERS }}
|
key: ${{ runner.os }}-php-${{ inputs.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: ${{ runner.os }}-php-${{ inputs.php-version }}-composer-
|
||||||
|
|
||||||
- name: Cache Build Output
|
- name: Install Node and PHP Dependencies
|
||||||
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
|
shell: bash
|
||||||
with:
|
run: |
|
||||||
path: node_modules/.cache/turbo
|
pnpm -w install turbo
|
||||||
key: ${{ runner.os }}-build-output-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
|
pnpm install ${{ steps.parse-input.outputs.INSTALL_FILTERS }}
|
||||||
restore-keys: ${{ runner.os }}-build-output-
|
|
||||||
|
|
||||||
- name: Build
|
- name: Cache Build Output
|
||||||
if: ${{ inputs.build == 'true' }}
|
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77
|
||||||
shell: bash
|
with:
|
||||||
run: pnpm -w exec turbo run turbo:build ${{ steps.parse-input.outputs.BUILD_FILTERS }}
|
path: node_modules/.cache/turbo
|
||||||
|
key: ${{ runner.os }}-build-output-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
|
||||||
|
restore-keys: ${{ runner.os }}-build-output-
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
if: ${{ inputs.build == 'true' }}
|
||||||
|
shell: bash
|
||||||
|
run: pnpm -w exec turbo run turbo:build ${{ steps.parse-input.outputs.BUILD_FILTERS }}
|
||||||
|
|
|
@ -25,8 +25,8 @@ jobs:
|
||||||
- name: Load docker images and start containers.
|
- name: Load docker images and start containers.
|
||||||
working-directory: plugins/woocommerce
|
working-directory: plugins/woocommerce
|
||||||
env:
|
env:
|
||||||
ENABLE_HPOS: 0
|
ENABLE_HPOS: 0
|
||||||
WP_ENV_PHP_VERSION: 7.4
|
WP_ENV_PHP_VERSION: 7.4
|
||||||
run: pnpm run env:test
|
run: pnpm run env:test
|
||||||
|
|
||||||
- name: Download and install Chromium browser.
|
- name: Download and install Chromium browser.
|
||||||
|
@ -40,7 +40,7 @@ jobs:
|
||||||
TOTAL_STR=$(pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js --list | grep "Total:")
|
TOTAL_STR=$(pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js --list | grep "Total:")
|
||||||
NO_PREFIX=${TOTAL_STR#*"Total: "}
|
NO_PREFIX=${TOTAL_STR#*"Total: "}
|
||||||
COUNT=${NO_PREFIX%" tests in"*}
|
COUNT=${NO_PREFIX%" tests in"*}
|
||||||
echo "::set-output name=E2E_GRAND_TOTAL::$COUNT"
|
echo "E2E_GRAND_TOTAL=$COUNT" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Run Playwright E2E tests.
|
- name: Run Playwright E2E tests.
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
|
@ -91,7 +91,7 @@ jobs:
|
||||||
- name: Load docker images and start containers.
|
- name: Load docker images and start containers.
|
||||||
working-directory: plugins/woocommerce
|
working-directory: plugins/woocommerce
|
||||||
env:
|
env:
|
||||||
ENABLE_HPOS: 0
|
ENABLE_HPOS: 0
|
||||||
run: pnpm env:test --filter=woocommerce
|
run: pnpm env:test --filter=woocommerce
|
||||||
|
|
||||||
- name: Run Playwright API tests.
|
- name: Run Playwright API tests.
|
||||||
|
@ -138,7 +138,7 @@ jobs:
|
||||||
- name: Load docker images and start containers.
|
- name: Load docker images and start containers.
|
||||||
working-directory: plugins/woocommerce
|
working-directory: plugins/woocommerce
|
||||||
env:
|
env:
|
||||||
ENABLE_HPOS: 0
|
ENABLE_HPOS: 0
|
||||||
run: |
|
run: |
|
||||||
pnpm env:dev --filter=woocommerce
|
pnpm env:dev --filter=woocommerce
|
||||||
pnpm env:performance-init --filter=woocommerce
|
pnpm env:performance-init --filter=woocommerce
|
||||||
|
|
|
@ -12,7 +12,7 @@ jobs:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup WooCommerce Monorepo
|
- name: Setup WooCommerce Monorepo
|
||||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||||
|
|
||||||
|
@ -24,17 +24,17 @@ jobs:
|
||||||
|
|
||||||
- name: Get current date
|
- name: Get current date
|
||||||
id: date
|
id: date
|
||||||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
|
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Set all package string
|
- name: Set all package string
|
||||||
id: all_description
|
id: all_description
|
||||||
if: ${{ github.event.inputs.packages == '-a'}}
|
if: ${{ github.event.inputs.packages == '-a'}}
|
||||||
run: echo "::set-output name=str::all packages"
|
run: echo "str=all packages" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Set Specific packages string
|
- name: Set Specific packages string
|
||||||
id: specific_description
|
id: specific_description
|
||||||
if: ${{ github.event.inputs.packages != '-a'}}
|
if: ${{ github.event.inputs.packages != '-a'}}
|
||||||
run: echo "::set-output name=str::${{ github.event.inputs.packages }}"
|
run: echo "str=${{ github.event.inputs.packages }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@v4
|
uses: peter-evans/create-pull-request@v4
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
name: "Release: Generate changelog"
|
name: 'Release: Generate changelog'
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
releaseBranch:
|
releaseBranch:
|
||||||
description: 'The name of the release branch, in the format `release/x.y`'
|
description: 'The name of the release branch, in the format `release/x.y`'
|
||||||
required: true
|
required: true
|
||||||
releaseVersion:
|
releaseVersion:
|
||||||
description: 'The version of the release, in the format `x.y`'
|
description: 'The version of the release, in the format `x.y`'
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GIT_COMMITTER_NAME: 'WooCommerce Bot'
|
GIT_COMMITTER_NAME: 'WooCommerce Bot'
|
||||||
|
@ -16,96 +16,96 @@ env:
|
||||||
GIT_AUTHOR_EMAIL: 'no-reply@woocommerce.com'
|
GIT_AUTHOR_EMAIL: 'no-reply@woocommerce.com'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create-changelog-prs:
|
create-changelog-prs:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup WooCommerce Monorepo
|
- name: Setup WooCommerce Monorepo
|
||||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||||
with:
|
with:
|
||||||
build: false
|
build: false
|
||||||
|
|
||||||
- name: "Git fetch the release branch"
|
- name: 'Git fetch the release branch'
|
||||||
run: git fetch origin ${{ inputs.releaseBranch }}
|
run: git fetch origin ${{ inputs.releaseBranch }}
|
||||||
|
|
||||||
- name: "Checkout the release branch"
|
|
||||||
run: git checkout ${{ inputs.releaseBranch }}
|
|
||||||
|
|
||||||
- name: "Create a new branch for the changelog update PR"
|
|
||||||
run: git checkout -b ${{ format( 'update/{0}-changelog', inputs.releaseVersion ) }}
|
|
||||||
|
|
||||||
- name: "Generate the changelog file"
|
- name: 'Checkout the release branch'
|
||||||
run: pnpm --filter=woocommerce run changelog write --add-pr-num -n -vvv --use-version ${{ inputs.releaseVersion }}
|
run: git checkout ${{ inputs.releaseBranch }}
|
||||||
|
|
||||||
- name: "git rm deleted files"
|
- name: 'Create a new branch for the changelog update PR'
|
||||||
run: git rm $(git ls-files --deleted)
|
run: git checkout -b ${{ format( 'update/{0}-changelog', inputs.releaseVersion ) }}
|
||||||
|
|
||||||
- name: "Commit deletion"
|
- name: 'Generate the changelog file'
|
||||||
run: git commit -m "Delete changelog files from ${{ inputs.releaseVersion }} release"
|
run: pnpm --filter=woocommerce run changelog write --add-pr-num -n -vvv --use-version ${{ inputs.releaseVersion }}
|
||||||
|
|
||||||
- name: "Remember the deletion commit hash"
|
- name: 'git rm deleted files'
|
||||||
id: rev-parse
|
run: git rm $(git ls-files --deleted)
|
||||||
run: echo "::set-output name=hash::$(git rev-parse HEAD)"
|
|
||||||
|
- name: 'Commit deletion'
|
||||||
- name: "Insert NEXT_CHANGELOG contents into readme.txt"
|
run: git commit -m "Delete changelog files from ${{ inputs.releaseVersion }} release"
|
||||||
run: php .github/workflows/scripts/release-changelog.php
|
|
||||||
|
- name: 'Remember the deletion commit hash'
|
||||||
- name: "git add readme.txt"
|
id: rev-parse
|
||||||
run: git add plugins/woocommerce/readme.txt
|
run: echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: "Commit readme"
|
- name: 'Insert NEXT_CHANGELOG contents into readme.txt'
|
||||||
run: git commit -m "Update the readme files for the ${{ inputs.releaseVersion }} release"
|
run: php .github/workflows/scripts/release-changelog.php
|
||||||
|
|
||||||
- name: "Push update branch to origin"
|
- name: 'git add readme.txt'
|
||||||
run: git push origin ${{ format( 'update/{0}-changelog', inputs.releaseVersion ) }}
|
run: git add plugins/woocommerce/readme.txt
|
||||||
|
|
||||||
- name: "Stash any other undesired changes"
|
- name: 'Commit readme'
|
||||||
run: git stash
|
run: git commit -m "Update the readme files for the ${{ inputs.releaseVersion }} release"
|
||||||
|
|
||||||
- name: "Checkout trunk"
|
- name: 'Push update branch to origin'
|
||||||
run: git checkout trunk
|
run: git push origin ${{ format( 'update/{0}-changelog', inputs.releaseVersion ) }}
|
||||||
|
|
||||||
- name: "Create a branch for the changelog files deletion"
|
- name: 'Stash any other undesired changes'
|
||||||
run: git checkout -b ${{ format( 'delete/{0}-changelog', inputs.releaseVersion ) }}
|
run: git stash
|
||||||
|
|
||||||
- name: "Cherry-pick the deletion commit"
|
- name: 'Checkout trunk'
|
||||||
run: git cherry-pick ${{ steps.rev-parse.outputs.hash }}
|
run: git checkout trunk
|
||||||
|
|
||||||
- name: "Push deletion branch to origin"
|
- name: 'Create a branch for the changelog files deletion'
|
||||||
run: git push origin ${{ format( 'delete/{0}-changelog', inputs.releaseVersion ) }}
|
run: git checkout -b ${{ format( 'delete/{0}-changelog', inputs.releaseVersion ) }}
|
||||||
|
|
||||||
- name: "Create release branch PR"
|
- name: 'Cherry-pick the deletion commit'
|
||||||
id: release-pr
|
run: git cherry-pick ${{ steps.rev-parse.outputs.hash }}
|
||||||
uses: actions/github-script@v6
|
|
||||||
with:
|
- name: 'Push deletion branch to origin'
|
||||||
script: |
|
run: git push origin ${{ format( 'delete/{0}-changelog', inputs.releaseVersion ) }}
|
||||||
const result = await github.rest.pulls.create( {
|
|
||||||
owner: "${{ github.repository_owner }}",
|
- name: 'Create release branch PR'
|
||||||
repo: "${{ github.event.repository.name }}",
|
id: release-pr
|
||||||
head: "${{ format( 'update/{0}-changelog', inputs.releaseVersion ) }}",
|
uses: actions/github-script@v6
|
||||||
base: "${{ inputs.releaseBranch }}",
|
with:
|
||||||
title: "${{ format( 'Release: Prepare the changelog for {0}', inputs.releaseVersion ) }}",
|
script: |
|
||||||
body: "${{ format( 'This pull request was automatically generated during the code freeze to prepare the changelog for {0}', inputs.releaseVersion ) }}"
|
const result = await github.rest.pulls.create( {
|
||||||
} );
|
owner: "${{ github.repository_owner }}",
|
||||||
|
repo: "${{ github.event.repository.name }}",
|
||||||
return result.data.number;
|
head: "${{ format( 'update/{0}-changelog', inputs.releaseVersion ) }}",
|
||||||
|
base: "${{ inputs.releaseBranch }}",
|
||||||
- name: "Create trunk PR"
|
title: "${{ format( 'Release: Prepare the changelog for {0}', inputs.releaseVersion ) }}",
|
||||||
id: trunk-pr
|
body: "${{ format( 'This pull request was automatically generated during the code freeze to prepare the changelog for {0}', inputs.releaseVersion ) }}"
|
||||||
uses: actions/github-script@v6
|
} );
|
||||||
with:
|
|
||||||
script: |
|
return result.data.number;
|
||||||
const result = await github.rest.pulls.create( {
|
|
||||||
owner: "${{ github.repository_owner }}",
|
- name: 'Create trunk PR'
|
||||||
repo: "${{ github.event.repository.name }}",
|
id: trunk-pr
|
||||||
head: "${{ format( 'delete/{0}-changelog', inputs.releaseVersion ) }}",
|
uses: actions/github-script@v6
|
||||||
base: "trunk",
|
with:
|
||||||
title: "${{ format( 'Release: Remove {0} change files', inputs.releaseVersion ) }}",
|
script: |
|
||||||
body: "${{ format( 'This pull request was automatically generated during the code freeze to remove the changefiles from {0} that are compiled into the `{1}` branch via #{2}', inputs.releaseVersion, inputs.releaseBranch, steps.release-pr.outputs.result ) }}"
|
const result = await github.rest.pulls.create( {
|
||||||
} );
|
owner: "${{ github.repository_owner }}",
|
||||||
|
repo: "${{ github.event.repository.name }}",
|
||||||
return result.data.number;
|
head: "${{ format( 'delete/{0}-changelog', inputs.releaseVersion ) }}",
|
||||||
|
base: "trunk",
|
||||||
|
title: "${{ format( 'Release: Remove {0} change files', inputs.releaseVersion ) }}",
|
||||||
|
body: "${{ format( 'This pull request was automatically generated during the code freeze to remove the changefiles from {0} that are compiled into the `{1}` branch via #{2}', inputs.releaseVersion, inputs.releaseBranch, steps.release-pr.outputs.result ) }}"
|
||||||
|
} );
|
||||||
|
|
||||||
|
return result.data.number;
|
||||||
|
|
|
@ -49,9 +49,9 @@ jobs:
|
||||||
|
|
||||||
// If 26 days from now isn't the second Tuesday, then it's not code freeze day.
|
// If 26 days from now isn't the second Tuesday, then it's not code freeze day.
|
||||||
if ( 'Tuesday' !== $release_day_of_week || $release_day_of_month < 8 || $release_day_of_month > 14 ) {
|
if ( 'Tuesday' !== $release_day_of_week || $release_day_of_month < 8 || $release_day_of_month > 14 ) {
|
||||||
echo '::set-output name=freeze::1';
|
file_put_contents( getenv( 'GITHUB_OUTPUT' ), "freeze=1\n", FILE_APPEND );
|
||||||
} else {
|
} else {
|
||||||
echo '::set-output name=freeze::0';
|
file_put_contents( getenv( 'GITHUB_OUTPUT' ), "freeze=0\n", FILE_APPEND );
|
||||||
}
|
}
|
||||||
|
|
||||||
maybe-create-next-milestone-and-release-branch:
|
maybe-create-next-milestone-and-release-branch:
|
||||||
|
|
Loading…
Reference in New Issue