From 8a7b1f9953835fab3aa87620fba4267ebd282bb0 Mon Sep 17 00:00:00 2001 From: Eric Willhoit Date: Wed, 5 Jun 2024 16:19:08 -0500 Subject: [PATCH] chore: update external actions --- .../actions/generateOclifReadme/action.yml | 2 +- .github/actions/get-json-property/action.yml | 35 ++++++++++++ .github/actions/getGithubUserInfo/action.yml | 2 +- .github/actions/getPreReleaseTag/action.yml | 20 ++----- .github/actions/parse-semver/action.yml | 56 +++++++++++++++++++ .github/actions/retry/action.yml | 2 +- .github/workflows/create-github-release.yml | 6 +- .github/workflows/devScriptsUpdate.yml | 2 +- .github/workflows/externalNut.yml | 2 +- .github/workflows/githubRelease.yml | 4 +- .github/workflows/nut.yml | 2 +- .github/workflows/packUploadWindows.yml | 2 +- .github/workflows/unitTestsLinux.yml | 2 +- .github/workflows/unitTestsWindows.yml | 2 +- .github/workflows/validatePR.yml | 8 +-- README.md | 2 +- 16 files changed, 115 insertions(+), 34 deletions(-) create mode 100644 .github/actions/get-json-property/action.yml create mode 100644 .github/actions/parse-semver/action.yml diff --git a/.github/actions/generateOclifReadme/action.yml b/.github/actions/generateOclifReadme/action.yml index be29833..17551a2 100644 --- a/.github/actions/generateOclifReadme/action.yml +++ b/.github/actions/generateOclifReadme/action.yml @@ -26,7 +26,7 @@ runs: - name: Get the next version for oclif readme id: next-version if: ${{ steps.is-oclif-plugin.outputs.bool == 'true' }} - uses: TriPSs/conventional-changelog-action@9962c3267b32873dbc552a38a8397194361e1101 + uses: TriPSs/conventional-changelog-action@3a392e9aa44a72686b0fc13259a90d287dd0877c with: tag-prefix: "" skip-version-file: true # Do not update the version in the package.json diff --git a/.github/actions/get-json-property/action.yml b/.github/actions/get-json-property/action.yml new file mode 100644 index 0000000..1a795e5 --- /dev/null +++ b/.github/actions/get-json-property/action.yml @@ -0,0 +1,35 @@ +name: get-json-property +description: Get a property from a json file using jq + +# Examples: +# prop_path: version +# prop_path: devDependencies["@salesforce/dev-scripts"] + + +inputs: + path: + required: true + description: Json file to look up prop (package.json) + prop_path: + required: true + description: jq query to search (version) + +outputs: + prop: + description: The value of the prop_path + value: ${{ steps.jq.outputs.prop }} + +runs: + using: "composite" + steps: + - name: Get property from json file + id: jq + shell: bash + run: | + PROP=$(jq -r '.${{ inputs.prop_path }}' ${{ inputs.path }}) + echo "prop=$PROP" >> "$GITHUB_OUTPUT" + - name: Exit if prop was not found + if: ${{ steps.jq.outputs.prop == 'null' }} + uses: actions/github-script@v7 + with: + script: core.setFailed("Property '${{ inputs.prop_path }}' not found in ${{ inputs.path }}") diff --git a/.github/actions/getGithubUserInfo/action.yml b/.github/actions/getGithubUserInfo/action.yml index edf36aa..e3e9586 100644 --- a/.github/actions/getGithubUserInfo/action.yml +++ b/.github/actions/getGithubUserInfo/action.yml @@ -19,7 +19,7 @@ runs: steps: - name: Validate token is passed if: inputs.SVC_CLI_BOT_GITHUB_TOKEN == '' - uses: actions/github-script@v3 + uses: actions/github-script@v7 with: script: core.setFailed("You must pass a Github Token with repo write access as SVC_CLI_BOT_GITHUB_TOKEN") - name: Get Github user info diff --git a/.github/actions/getPreReleaseTag/action.yml b/.github/actions/getPreReleaseTag/action.yml index 7e4b31b..11e80f1 100644 --- a/.github/actions/getPreReleaseTag/action.yml +++ b/.github/actions/getPreReleaseTag/action.yml @@ -3,7 +3,7 @@ description: read package.json and return the version suffix (ex 'beta' if x.y.z outputs: tag: - value: ${{ steps.tag.outputs.match }} + value: ${{ steps.parsed.outputs.prerelease }} description: version suffix (ex 'beta' if x.y.z-beta.0 ), if exists in package.json version: value: ${{ steps.packageVersion.outputs.prop }} @@ -12,7 +12,7 @@ outputs: runs: using: composite steps: - - uses: notiz-dev/github-action-json-property@7a701887f4b568b23eb7b78bb0fc49aaeb1b68d3 + - uses: salesforcecli/github-workflows/.github/actions/get-json-property@main id: packageVersion with: path: "package.json" @@ -21,20 +21,10 @@ runs: - run: echo "found version ${{ steps.packageVersion.outputs.prop }}" shell: bash - - uses: booxmedialtd/ws-action-parse-semver@7784200024d6b3fc01253e617ec0168daf603de3 - id: versionSuffix + - uses: salesforcecli/github-workflows/.github/actions/parse-semver@main + id: parsed with: input_string: ${{ steps.packageVersion.outputs.prop }} - - run: echo "found prerelease ${{ steps.versionSuffix.outputs.prerelease }}" - shell: bash - - - uses: actions-ecosystem/action-regex-match@d50fd2e7a37d0e617aea3d7ada663bd56862b9cc - id: tag - with: - text: ${{ steps.versionSuffix.outputs.prerelease }} - # at this point, we have just the prerelease section, but it includes the final .0 or whatever - regex: '.*(?=\.\d+)' - - - run: echo "found tag ${{ steps.tag.outputs.match }}" + - run: echo "found prerelease tag ${{ steps.parsed.outputs.prerelease }}" shell: bash diff --git a/.github/actions/parse-semver/action.yml b/.github/actions/parse-semver/action.yml new file mode 100644 index 0000000..9d22997 --- /dev/null +++ b/.github/actions/parse-semver/action.yml @@ -0,0 +1,56 @@ +name: Parse Semver + +description: Extracts major, minor, patch, prerelease, and full version from a given semver. + +inputs: + input_string: + description: 'The semver version to parse' + required: true + +outputs: + major: + description: 'MAJOR part of the semver' + value: ${{ steps.parse.outputs.major }} + minor: + description: 'MINOR part of the semver' + value: ${{ steps.parse.outputs.minor }} + patch: + description: 'PATCH part of the semver' + value: ${{ steps.parse.outputs.patch }} + prerelease: + description: 'Prerelease part of the semver' + value: ${{ steps.parse.outputs.prerelease }} + fullversion: + description: 'Full representation of the semver' + value: ${{ steps.parse.outputs.fullversion }} + +runs: + using: "composite" + steps: + - name: Parse Semver + id: parse + shell: bash + run: | + FULL_VERSION="${{ inputs.version }}" + VERSION="${FULL_VERSION#v}" + + # Split version into parts + IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" + + # Check if PATCH contains prerelease info and extract it + if [[ "$PATCH" == *-* ]]; then + PRERELEASE=$(echo "$PATCH" | cut -d- -f2 | cut -d. -f1) + PATCH=$(echo "$PATCH" | cut -d- -f1) + fi + + # Set outputs + echo "major=$MAJOR" >> "$GITHUB_OUTPUT" + echo "minor=$MINOR" >> "$GITHUB_OUTPUT" + echo "patch=$PATCH" >> "$GITHUB_OUTPUT" + echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT" + echo "fullversion=$FULL_VERSION" >> "$GITHUB_OUTPUT" + - name: Exit if major, minor, or patch not found + if: ${{ !steps.parse.outputs.major || !steps.parse.outputs.minor || !steps.parse.outputs.patch }} + uses: actions/github-script@v7 + with: + script: core.setFailed("Error parsing semver ${{ inputs.version }}\nMajor:${{ steps.parse.outputs.major }}\nMinor:${{ steps.parse.outputs.minor }}\nPatch:${{ steps.parse.outputs.patch }}") \ No newline at end of file diff --git a/.github/actions/retry/action.yml b/.github/actions/retry/action.yml index 585c82e..46072ec 100644 --- a/.github/actions/retry/action.yml +++ b/.github/actions/retry/action.yml @@ -21,7 +21,7 @@ inputs: runs: using: "composite" steps: - - uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd + - uses: nick-fields/retry@3f757583fb1b1f940bc8ef4bf4734c8dc02a5847 with: max_attempts: ${{ inputs.max_attempts }} retry_wait_seconds: ${{ inputs.retry_wait_seconds }} diff --git a/.github/workflows/create-github-release.yml b/.github/workflows/create-github-release.yml index f961994..4bb64f1 100644 --- a/.github/workflows/create-github-release.yml +++ b/.github/workflows/create-github-release.yml @@ -42,7 +42,7 @@ jobs: - name: Validate prerelease if: github.ref_name == 'main' && inputs.prerelease - uses: actions/github-script@v3 + uses: actions/github-script@v7 with: script: | core.setFailed('Do not create a prerelease on "main". You can create a prerelease on a branch and when it is merged it will create a non-prerelease Release. For example: 1.0.1-beta.2 will release as 1.0.1 when merged into main.') @@ -75,7 +75,7 @@ jobs: - name: Conventional Changelog Action id: changelog - uses: TriPSs/conventional-changelog-action@9962c3267b32873dbc552a38a8397194361e1101 + uses: TriPSs/conventional-changelog-action@3a392e9aa44a72686b0fc13259a90d287dd0877c with: git-user-name: ${{ steps.github-user-info.outputs.username }} git-user-email: ${{ steps.github-user-info.outputs.email }} @@ -90,7 +90,7 @@ jobs: output-file: ${{ steps.prereleaseTag.outputs.tag && 'false' || 'CHANGELOG.md' }} # If prerelease, do not write the changelog file - name: Create Github Release - uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 + uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 if: ${{ steps.changelog.outputs.skipped == 'false' }} with: name: ${{ steps.changelog.outputs.tag }} diff --git a/.github/workflows/devScriptsUpdate.yml b/.github/workflows/devScriptsUpdate.yml index bd09340..f28d03f 100644 --- a/.github/workflows/devScriptsUpdate.yml +++ b/.github/workflows/devScriptsUpdate.yml @@ -21,7 +21,7 @@ jobs: version: latest npmPackage: "@salesforce/dev-scripts" - run: echo "dev scripts latest is ${{ steps.version-info.outputs.version }}" - - uses: notiz-dev/github-action-json-property@7a701887f4b568b23eb7b78bb0fc49aaeb1b68d3 + - uses: salesforcecli/github-workflows/.github/actions/get-json-property@main id: packageVersion with: path: "package.json" diff --git a/.github/workflows/externalNut.yml b/.github/workflows/externalNut.yml index 6d478a1..7e078e2 100644 --- a/.github/workflows/externalNut.yml +++ b/.github/workflows/externalNut.yml @@ -105,7 +105,7 @@ jobs: - name: Cache node modules if: inputs.useCache id: cache-nodemodules - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-node-modules with: diff --git a/.github/workflows/githubRelease.yml b/.github/workflows/githubRelease.yml index 50e1840..5f1aae7 100644 --- a/.github/workflows/githubRelease.yml +++ b/.github/workflows/githubRelease.yml @@ -43,14 +43,14 @@ jobs: - name: prerelease package.json validation if: inputs.prerelease && !steps.distTag.outputs.tag - uses: actions/github-script@v3 + uses: actions/github-script@v7 with: script: | core.setFailed('Prerelease requires a dist tag name in your package.json like beta in 1.1.1-beta.0') - name: Conventional Changelog Action id: changelog - uses: TriPSs/conventional-changelog-action@9962c3267b32873dbc552a38a8397194361e1101 + uses: TriPSs/conventional-changelog-action@3a392e9aa44a72686b0fc13259a90d287dd0877c with: git-user-name: svc-cli-bot git-user-email: svc_cli_bot@salesforce.com diff --git a/.github/workflows/nut.yml b/.github/workflows/nut.yml index 43586d5..dc1f9b8 100644 --- a/.github/workflows/nut.yml +++ b/.github/workflows/nut.yml @@ -70,7 +70,7 @@ jobs: cache: yarn - name: Cache node modules id: cache-nodemodules - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-node-modules with: diff --git a/.github/workflows/packUploadWindows.yml b/.github/workflows/packUploadWindows.yml index 8806193..9f05fa1 100644 --- a/.github/workflows/packUploadWindows.yml +++ b/.github/workflows/packUploadWindows.yml @@ -37,7 +37,7 @@ jobs: cache: yarn - name: Set up Homebrew id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@41775cf0c82ef066f1eb39cea1bd74697ca5b735 + uses: Homebrew/actions/setup-homebrew@e05416b42376bcda221f9102c4f595f4994016be - run: brew install makensis - uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main - run: yarn pack:win diff --git a/.github/workflows/unitTestsLinux.yml b/.github/workflows/unitTestsLinux.yml index f8631d6..61ea26c 100644 --- a/.github/workflows/unitTestsLinux.yml +++ b/.github/workflows/unitTestsLinux.yml @@ -30,7 +30,7 @@ jobs: continue-on-error: true - name: Cache node modules id: cache-nodemodules - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-node-modules with: diff --git a/.github/workflows/unitTestsWindows.yml b/.github/workflows/unitTestsWindows.yml index 851db98..3382d9d 100644 --- a/.github/workflows/unitTestsWindows.yml +++ b/.github/workflows/unitTestsWindows.yml @@ -31,7 +31,7 @@ jobs: cache: yarn - name: Cache node modules id: cache-nodemodules - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-node-modules with: diff --git a/.github/workflows/validatePR.yml b/.github/workflows/validatePR.yml index 59edbf6..b051458 100644 --- a/.github/workflows/validatePR.yml +++ b/.github/workflows/validatePR.yml @@ -7,25 +7,25 @@ jobs: if: ${{ !contains(github.event.pull_request.body, '[skip-validate-pr]') && !contains(github.event.pull_request.title, '[skip-validate-pr]') }} runs-on: "ubuntu-latest" steps: - - uses: actions-ecosystem/action-regex-match@d50fd2e7a37d0e617aea3d7ada663bd56862b9cc + - uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8 id: regex-match-gus-wi with: text: ${{ github.event.pull_request.body }} regex: '@W-\d{7,8}@' flags: gm - - uses: actions-ecosystem/action-regex-match@d50fd2e7a37d0e617aea3d7ada663bd56862b9cc + - uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8 id: regex-match-gha-run with: text: ${{ github.event.pull_request.body }} regex: 'https:\/\/github.com\/.*\/actions\/runs\/' flags: gm - - uses: actions-ecosystem/action-regex-match@d50fd2e7a37d0e617aea3d7ada663bd56862b9cc + - uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8 id: regex-match-gh-issue with: text: ${{ github.event.pull_request.body }} regex: "#[0-9]+" flags: gm - - uses: actions-ecosystem/action-regex-match@d50fd2e7a37d0e617aea3d7ada663bd56862b9cc + - uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8 id: regex-match-cli-gh-issue with: text: ${{ github.event.pull_request.body }} diff --git a/README.md b/README.md index f06b129..fc1d4b6 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ jobs: tag: ${{ steps.distTag.outputs.tag }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.release.tag_name || inputs.tag }} - uses: salesforcecli/github-workflows/.github/actions/getPreReleaseTag@main