Skip to content

Commit 093ba0c

Browse files
authored
Merge pull request #108 from salesforcecli/ew/update-actions
Update external actions
2 parents b00710b + 8a7b1f9 commit 093ba0c

16 files changed

Lines changed: 115 additions & 34 deletions

File tree

.github/actions/generateOclifReadme/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ runs:
2626
- name: Get the next version for oclif readme
2727
id: next-version
2828
if: ${{ steps.is-oclif-plugin.outputs.bool == 'true' }}
29-
uses: TriPSs/conventional-changelog-action@9962c3267b32873dbc552a38a8397194361e1101
29+
uses: TriPSs/conventional-changelog-action@3a392e9aa44a72686b0fc13259a90d287dd0877c
3030
with:
3131
tag-prefix: ""
3232
skip-version-file: true # Do not update the version in the package.json
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: get-json-property
2+
description: Get a property from a json file using jq
3+
4+
# Examples:
5+
# prop_path: version
6+
# prop_path: devDependencies["@salesforce/dev-scripts"]
7+
8+
9+
inputs:
10+
path:
11+
required: true
12+
description: Json file to look up prop (package.json)
13+
prop_path:
14+
required: true
15+
description: jq query to search (version)
16+
17+
outputs:
18+
prop:
19+
description: The value of the prop_path
20+
value: ${{ steps.jq.outputs.prop }}
21+
22+
runs:
23+
using: "composite"
24+
steps:
25+
- name: Get property from json file
26+
id: jq
27+
shell: bash
28+
run: |
29+
PROP=$(jq -r '.${{ inputs.prop_path }}' ${{ inputs.path }})
30+
echo "prop=$PROP" >> "$GITHUB_OUTPUT"
31+
- name: Exit if prop was not found
32+
if: ${{ steps.jq.outputs.prop == 'null' }}
33+
uses: actions/github-script@v7
34+
with:
35+
script: core.setFailed("Property '${{ inputs.prop_path }}' not found in ${{ inputs.path }}")

.github/actions/getGithubUserInfo/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ runs:
1919
steps:
2020
- name: Validate token is passed
2121
if: inputs.SVC_CLI_BOT_GITHUB_TOKEN == ''
22-
uses: actions/github-script@v3
22+
uses: actions/github-script@v7
2323
with:
2424
script: core.setFailed("You must pass a Github Token with repo write access as SVC_CLI_BOT_GITHUB_TOKEN")
2525
- name: Get Github user info

.github/actions/getPreReleaseTag/action.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: read package.json and return the version suffix (ex 'beta' if x.y.z
33

44
outputs:
55
tag:
6-
value: ${{ steps.tag.outputs.match }}
6+
value: ${{ steps.parsed.outputs.prerelease }}
77
description: version suffix (ex 'beta' if x.y.z-beta.0 ), if exists in package.json
88
version:
99
value: ${{ steps.packageVersion.outputs.prop }}
@@ -12,7 +12,7 @@ outputs:
1212
runs:
1313
using: composite
1414
steps:
15-
- uses: notiz-dev/github-action-json-property@7a701887f4b568b23eb7b78bb0fc49aaeb1b68d3
15+
- uses: salesforcecli/github-workflows/.github/actions/get-json-property@main
1616
id: packageVersion
1717
with:
1818
path: "package.json"
@@ -21,20 +21,10 @@ runs:
2121
- run: echo "found version ${{ steps.packageVersion.outputs.prop }}"
2222
shell: bash
2323

24-
- uses: booxmedialtd/ws-action-parse-semver@7784200024d6b3fc01253e617ec0168daf603de3
25-
id: versionSuffix
24+
- uses: salesforcecli/github-workflows/.github/actions/parse-semver@main
25+
id: parsed
2626
with:
2727
input_string: ${{ steps.packageVersion.outputs.prop }}
2828

29-
- run: echo "found prerelease ${{ steps.versionSuffix.outputs.prerelease }}"
30-
shell: bash
31-
32-
- uses: actions-ecosystem/action-regex-match@d50fd2e7a37d0e617aea3d7ada663bd56862b9cc
33-
id: tag
34-
with:
35-
text: ${{ steps.versionSuffix.outputs.prerelease }}
36-
# at this point, we have just the prerelease section, but it includes the final .0 or whatever
37-
regex: '.*(?=\.\d+)'
38-
39-
- run: echo "found tag ${{ steps.tag.outputs.match }}"
29+
- run: echo "found prerelease tag ${{ steps.parsed.outputs.prerelease }}"
4030
shell: bash
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Parse Semver
2+
3+
description: Extracts major, minor, patch, prerelease, and full version from a given semver.
4+
5+
inputs:
6+
input_string:
7+
description: 'The semver version to parse'
8+
required: true
9+
10+
outputs:
11+
major:
12+
description: 'MAJOR part of the semver'
13+
value: ${{ steps.parse.outputs.major }}
14+
minor:
15+
description: 'MINOR part of the semver'
16+
value: ${{ steps.parse.outputs.minor }}
17+
patch:
18+
description: 'PATCH part of the semver'
19+
value: ${{ steps.parse.outputs.patch }}
20+
prerelease:
21+
description: 'Prerelease part of the semver'
22+
value: ${{ steps.parse.outputs.prerelease }}
23+
fullversion:
24+
description: 'Full representation of the semver'
25+
value: ${{ steps.parse.outputs.fullversion }}
26+
27+
runs:
28+
using: "composite"
29+
steps:
30+
- name: Parse Semver
31+
id: parse
32+
shell: bash
33+
run: |
34+
FULL_VERSION="${{ inputs.version }}"
35+
VERSION="${FULL_VERSION#v}"
36+
37+
# Split version into parts
38+
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
39+
40+
# Check if PATCH contains prerelease info and extract it
41+
if [[ "$PATCH" == *-* ]]; then
42+
PRERELEASE=$(echo "$PATCH" | cut -d- -f2 | cut -d. -f1)
43+
PATCH=$(echo "$PATCH" | cut -d- -f1)
44+
fi
45+
46+
# Set outputs
47+
echo "major=$MAJOR" >> "$GITHUB_OUTPUT"
48+
echo "minor=$MINOR" >> "$GITHUB_OUTPUT"
49+
echo "patch=$PATCH" >> "$GITHUB_OUTPUT"
50+
echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT"
51+
echo "fullversion=$FULL_VERSION" >> "$GITHUB_OUTPUT"
52+
- name: Exit if major, minor, or patch not found
53+
if: ${{ !steps.parse.outputs.major || !steps.parse.outputs.minor || !steps.parse.outputs.patch }}
54+
uses: actions/github-script@v7
55+
with:
56+
script: core.setFailed("Error parsing semver ${{ inputs.version }}\nMajor:${{ steps.parse.outputs.major }}\nMinor:${{ steps.parse.outputs.minor }}\nPatch:${{ steps.parse.outputs.patch }}")

.github/actions/retry/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ inputs:
2121
runs:
2222
using: "composite"
2323
steps:
24-
- uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd
24+
- uses: nick-fields/retry@3f757583fb1b1f940bc8ef4bf4734c8dc02a5847
2525
with:
2626
max_attempts: ${{ inputs.max_attempts }}
2727
retry_wait_seconds: ${{ inputs.retry_wait_seconds }}

.github/workflows/create-github-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242

4343
- name: Validate prerelease
4444
if: github.ref_name == 'main' && inputs.prerelease
45-
uses: actions/github-script@v3
45+
uses: actions/github-script@v7
4646
with:
4747
script: |
4848
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:
7575

7676
- name: Conventional Changelog Action
7777
id: changelog
78-
uses: TriPSs/conventional-changelog-action@9962c3267b32873dbc552a38a8397194361e1101
78+
uses: TriPSs/conventional-changelog-action@3a392e9aa44a72686b0fc13259a90d287dd0877c
7979
with:
8080
git-user-name: ${{ steps.github-user-info.outputs.username }}
8181
git-user-email: ${{ steps.github-user-info.outputs.email }}
@@ -90,7 +90,7 @@ jobs:
9090
output-file: ${{ steps.prereleaseTag.outputs.tag && 'false' || 'CHANGELOG.md' }} # If prerelease, do not write the changelog file
9191

9292
- name: Create Github Release
93-
uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5
93+
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5
9494
if: ${{ steps.changelog.outputs.skipped == 'false' }}
9595
with:
9696
name: ${{ steps.changelog.outputs.tag }}

.github/workflows/devScriptsUpdate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
version: latest
2222
npmPackage: "@salesforce/dev-scripts"
2323
- run: echo "dev scripts latest is ${{ steps.version-info.outputs.version }}"
24-
- uses: notiz-dev/github-action-json-property@7a701887f4b568b23eb7b78bb0fc49aaeb1b68d3
24+
- uses: salesforcecli/github-workflows/.github/actions/get-json-property@main
2525
id: packageVersion
2626
with:
2727
path: "package.json"

.github/workflows/externalNut.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
- name: Cache node modules
106106
if: inputs.useCache
107107
id: cache-nodemodules
108-
uses: actions/cache@v3
108+
uses: actions/cache@v4
109109
env:
110110
cache-name: cache-node-modules
111111
with:

.github/workflows/githubRelease.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ jobs:
4343

4444
- name: prerelease package.json validation
4545
if: inputs.prerelease && !steps.distTag.outputs.tag
46-
uses: actions/github-script@v3
46+
uses: actions/github-script@v7
4747
with:
4848
script: |
4949
core.setFailed('Prerelease requires a dist tag name in your package.json like beta in 1.1.1-beta.0')
5050
5151
- name: Conventional Changelog Action
5252
id: changelog
53-
uses: TriPSs/conventional-changelog-action@9962c3267b32873dbc552a38a8397194361e1101
53+
uses: TriPSs/conventional-changelog-action@3a392e9aa44a72686b0fc13259a90d287dd0877c
5454
with:
5555
git-user-name: svc-cli-bot
5656
git-user-email: svc_cli_bot@salesforce.com

0 commit comments

Comments
 (0)