Skip to content

Commit

Permalink
Merge pull request #423 from woocommerce/dev/upgrade-gha-workflows
Browse files Browse the repository at this point in the history
Upgrade the workflows in GitHub Actions to use Node.js v20
  • Loading branch information
eason9487 authored May 17, 2024
2 parents 9330120 + c80cca4 commit c0fff06
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 31 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/backlog-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ on:
types:
- opened
- transferred
pull_request:
pull_request_target:
types:
- opened

jobs:
add-to-project:
name: Add issue/PR to project
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v0.4.0
- uses: actions/add-to-project@v1.0.1
with:
project-url: https://github.com/orgs/woocommerce/projects/119
github-token: ${{ secrets.BOT_GH_TOKEN }}
8 changes: 6 additions & 2 deletions .github/workflows/branch-labels.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Set PR Labels

on:
pull_request:
pull_request_target:
types: opened

jobs:
SetLabels:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Set Labels
uses: woocommerce/grow/branch-label@actions-v1
uses: woocommerce/grow/branch-label@actions-v2
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
FORCE_COLOR: 2
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
uses: woocommerce/grow/prepare-php@actions-v2
with:
install-deps: "no"

- name: Prepare node
uses: woocommerce/grow/prepare-node@actions-v1
uses: woocommerce/grow/prepare-node@actions-v2
with:
node-version-file: ".nvmrc"
ignore-scripts: "no"
Expand All @@ -39,13 +39,13 @@ jobs:
- name: Publish dev build to GitHub
if: ${{ github.event_name == 'push' && github.ref_name == 'trunk' }}
uses: woocommerce/grow/publish-extension-dev-build@actions-v1
uses: woocommerce/grow/publish-extension-dev-build@actions-v2
with:
extension-asset-path: woocommerce-google-analytics-integration.zip

- name: Publish build artifact
if: ${{ ! ( github.event_name == 'push' && github.ref_name == 'trunk' ) }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: woocommerce-google-analytics-integration.zip
path: ${{ github.workspace }}/woocommerce-google-analytics-integration.zip
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ jobs:
FORCE_COLOR: 2
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
uses: woocommerce/grow/prepare-php@actions-v2
with:
install-deps: "no"

- name: Prepare node
uses: woocommerce/grow/prepare-node@actions-v1
uses: woocommerce/grow/prepare-node@actions-v2
with:
node-version-file: ".nvmrc"
ignore-scripts: "no"
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:

- name: Archive e2e failure screenshots
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: e2e-screenshots
path: tests/e2e/test-results/report/**/*.png
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/js-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Prepare node
uses: woocommerce/grow/prepare-node@actions-v1
uses: woocommerce/grow/prepare-node@actions-v2
with:
node-version-file: ".nvmrc"

- name: Prepare annotation formatter
uses: woocommerce/grow/eslint-annotation@actions-v1
uses: woocommerce/grow/eslint-annotation@actions-v2

- name: Lint JavaScript and annotate linting errors
run: npm run lint:js -- --quiet --format ./eslintFormatter.cjs
2 changes: 1 addition & 1 deletion .github/workflows/php-coding-standards-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Run PHPCS to changed lines of code
uses: woocommerce/grow/phpcs-diff@actions-v1
uses: woocommerce/grow/phpcs-diff@actions-v2
with:
php-version: 7.4
4 changes: 2 additions & 2 deletions .github/workflows/php-hook-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Checks out a branch instead of a commit in detached HEAD state
ref: ${{ github.head_ref }}

# This generates the documentation string. The `id` property is used to reference the output in the next step.
- name: Generate hook documentation
id: generate-hook-docs
uses: woocommerce/grow/hook-documentation@actions-v1
uses: woocommerce/grow/hook-documentation@actions-v2
with:
source-directories: includes/,woocommerce-google-analytics-integration.php

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/php-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ jobs:
steps:
- name: Get Release versions from Wordpress
id: wp
uses: woocommerce/grow/get-plugin-releases@actions-v1
uses: woocommerce/grow/get-plugin-releases@actions-v2
with:
slug: wordpress
- name: Get Release versions from WooCommerce
id: wc
uses: woocommerce/grow/get-plugin-releases@actions-v1
uses: woocommerce/grow/get-plugin-releases@actions-v2
with:
slug: woocommerce

Expand All @@ -73,15 +73,15 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
uses: woocommerce/grow/prepare-php@actions-v2
with:
php-version: "${{ matrix.php }}"

- name: Set up MySQL
uses: woocommerce/grow/prepare-mysql@actions-v1
uses: woocommerce/grow/prepare-mysql@actions-v2

- name: Run PHP unit tests
run: |
Expand Down Expand Up @@ -116,15 +116,15 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
uses: woocommerce/grow/prepare-php@actions-v2
with:
php-version: "${{ inputs.php-version }}"

- name: Prepare MySQL
uses: woocommerce/grow/prepare-mysql@actions-v1
uses: woocommerce/grow/prepare-mysql@actions-v2

- name: Install WP tests
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Create branch & PR
uses: woocommerce/grow/prepare-extension-release@actions-v1
uses: woocommerce/grow/prepare-extension-release@actions-v2
with:
version: ${{ github.event.inputs.version }}
type: ${{ github.event.inputs.type }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-qit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ jobs:
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: woocommerce-google-analytics-integration.zip
- name: Run QIT Tests
# Update it with more stable path once merged.
uses: woocommerce/grow/run-qit-extension@actions-v1
uses: woocommerce/grow/run-qit-extension@actions-v2
with:
qit-partner-user: ${{ secrets.QIT_PARTNER_USER }}
qit-partner-secret: ${{ secrets.QIT_PARTNER_SECRET }}
Expand Down

0 comments on commit c0fff06

Please sign in to comment.