Skip to content

Commit

Permalink
Merge pull request #108 from salesforcecli/ew/update-actions
Browse files Browse the repository at this point in the history
Update external actions
  • Loading branch information
iowillhoit authored Jun 10, 2024
2 parents b00710b + 8a7b1f9 commit 093ba0c
Show file tree
Hide file tree
Showing 16 changed files with 115 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/actions/generateOclifReadme/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 35 additions & 0 deletions .github/actions/get-json-property/action.yml
Original file line number Diff line number Diff line change
@@ -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 }}")
2 changes: 1 addition & 1 deletion .github/actions/getGithubUserInfo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 5 additions & 15 deletions .github/actions/getPreReleaseTag/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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"
Expand All @@ -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
56 changes: 56 additions & 0 deletions .github/actions/parse-semver/action.yml
Original file line number Diff line number Diff line change
@@ -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 }}")
2 changes: 1 addition & 1 deletion .github/actions/retry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/create-github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/devScriptsUpdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/externalNut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/githubRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/packUploadWindows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unitTestsLinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unitTestsWindows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/validatePR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 093ba0c

Please sign in to comment.