Skip to content

Commit 021540a

Browse files
authored
ci: upgrade actions (#456)
1 parent 14217c9 commit 021540a

File tree

1 file changed

+76
-77
lines changed

1 file changed

+76
-77
lines changed

.github/workflows/ci.yaml

Lines changed: 76 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,51 @@ on:
88
- main
99

1010
jobs:
11-
1211
test_format:
1312
runs-on: ubuntu-latest
1413
if: ${{ !github.event.created && github.repository != 'garronej/ts-ci' }}
1514
steps:
16-
- uses: actions/checkout@v3
17-
- uses: actions/setup-node@v3
18-
- uses: bahmutov/npm-install@v1
19-
- name: If this step fails run 'yarn format' then commit again.
20-
run: yarn format:check
15+
- uses: actions/checkout@v5
16+
- uses: actions/setup-node@v5
17+
- uses: bahmutov/npm-install@v1
18+
- name: If this step fails run 'yarn format' then commit again.
19+
run: yarn format:check
2120
test:
2221
runs-on: ${{ matrix.os }}
2322
needs: test_format
2423
strategy:
2524
matrix:
2625
#node: [ '16', '17' ]
27-
node: [ '20' ]
26+
node: ["22"]
2827
#os: [ windows-latest, ubuntu-latest ]
29-
os: [ ubuntu-latest ]
28+
os: [ubuntu-latest]
3029
name: Test with Node v${{ matrix.node }} on ${{ matrix.os }}
3130
steps:
32-
- uses: actions/checkout@v3
33-
with:
34-
fetch-depth: 0
35-
- uses: actions/setup-node@v3
36-
with:
37-
node-version: ${{ matrix.node }}
38-
- uses: bahmutov/npm-install@v1
39-
- run: yarn build
40-
- run: yarn test
31+
- uses: actions/checkout@v5
32+
with:
33+
fetch-depth: 0
34+
- uses: actions/setup-node@v5
35+
with:
36+
node-version: ${{ matrix.node }}
37+
- uses: bahmutov/npm-install@v1
38+
- run: yarn build
39+
- run: yarn test
4140

4241
deploy_storybook:
4342
runs-on: ubuntu-latest
4443
if: github.event_name == 'push'
4544
needs: test
4645
steps:
47-
- uses: actions/checkout@v3
48-
- uses: actions/setup-node@v3
49-
with:
50-
node-version: '18'
51-
- uses: bahmutov/npm-install@v1
52-
- run: yarn build-storybook -o ./build_storybook
53-
- run: git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${{github.repository}}.git
54-
env:
55-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56-
- run: npx -y -p [email protected] gh-pages -d ./build_storybook -u "github-actions-bot <[email protected]>"
46+
- uses: actions/checkout@v5
47+
- uses: actions/setup-node@v5
48+
with:
49+
node-version: "18"
50+
- uses: bahmutov/npm-install@v1
51+
- run: yarn build-storybook -o ./build_storybook
52+
- run: git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${{github.repository}}.git
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
- run: npx -y -p [email protected] gh-pages -d ./build_storybook -u "github-actions-bot <[email protected]>"
5756

5857
check_if_version_upgraded:
5958
name: Check if version upgrade
@@ -64,7 +63,7 @@ jobs:
6463
# it's cleaner to stop the execution instead of letting the CI crash.
6564
if: |
6665
github.event_name == 'push' ||
67-
github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
66+
github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
6867
runs-on: ubuntu-latest
6968
needs: test
7069
outputs:
@@ -73,10 +72,10 @@ jobs:
7372
is_upgraded_version: ${{ steps.step1.outputs.is_upgraded_version }}
7473
is_pre_release: ${{steps.step1.outputs.is_pre_release }}
7574
steps:
76-
- uses: garronej/[email protected].0
77-
id: step1
78-
with:
79-
action_name: is_package_json_version_upgraded
75+
- uses: garronej/[email protected].5
76+
id: step1
77+
with:
78+
action_name: is_package_json_version_upgraded
8079

8180
create_github_release:
8281
runs-on: ubuntu-latest
@@ -88,56 +87,56 @@ jobs:
8887
github.event_name == 'push' ||
8988
needs.check_if_version_upgraded.outputs.is_pre_release == 'true'
9089
)
91-
needs:
90+
needs:
9291
- check_if_version_upgraded
9392
steps:
94-
- uses: softprops/action-gh-release@v1
95-
with:
96-
name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }}
97-
tag_name: v${{ needs.check_if_version_upgraded.outputs.to_version }}
98-
target_commitish: ${{ github.head_ref || github.ref }}
99-
generate_release_notes: true
100-
draft: false
101-
prerelease: ${{ needs.check_if_version_upgraded.outputs.is_pre_release == 'true' }}
102-
env:
103-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
- uses: softprops/action-gh-release@v2
94+
with:
95+
name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }}
96+
tag_name: v${{ needs.check_if_version_upgraded.outputs.to_version }}
97+
target_commitish: ${{ github.head_ref || github.ref }}
98+
generate_release_notes: true
99+
draft: false
100+
prerelease: ${{ needs.check_if_version_upgraded.outputs.is_pre_release == 'true' }}
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104103

105104
publish_on_npm:
106105
runs-on: ubuntu-latest
107-
needs:
106+
needs:
108107
- create_github_release
109108
- check_if_version_upgraded
110109
steps:
111-
- uses: actions/checkout@v3
112-
with:
113-
ref: ${{ github.ref }}
114-
- uses: actions/setup-node@v3
115-
with:
116-
registry-url: https://registry.npmjs.org/
117-
- uses: bahmutov/npm-install@v1
118-
- run: yarn build --prePublish
119-
- run: npx -y -p [email protected] enable_short_npm_import_path
120-
env:
121-
DRY_RUN: "0"
122-
- uses: garronej/[email protected].0
123-
with:
124-
action_name: remove_dark_mode_specific_images_from_readme
125-
- name: Publishing on NPM
126-
run: |
127-
if [ "$(npm show . version)" = "$VERSION" ]; then
128-
echo "This version is already published"
129-
exit 0
130-
fi
131-
if [ "$NODE_AUTH_TOKEN" = "" ]; then
132-
echo "Can't publish on NPM, You must first create a secret called NPM_TOKEN that contains your NPM auth token. https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets"
133-
false
134-
fi
135-
EXTRA_ARGS=""
136-
if [ "$IS_PRE_RELEASE" = "true" ]; then
137-
EXTRA_ARGS="--tag next"
138-
fi
139-
npm publish $EXTRA_ARGS
140-
env:
141-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
142-
VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }}
143-
IS_PRE_RELEASE: ${{ needs.check_if_version_upgraded.outputs.is_pre_release }}
110+
- uses: actions/checkout@v3
111+
with:
112+
ref: ${{ github.ref }}
113+
- uses: actions/setup-node@v5
114+
with:
115+
registry-url: https://registry.npmjs.org/
116+
- uses: bahmutov/npm-install@v1
117+
- run: yarn build --prePublish
118+
- run: npx -y -p [email protected] enable_short_npm_import_path
119+
env:
120+
DRY_RUN: "0"
121+
- uses: garronej/[email protected].5
122+
with:
123+
action_name: remove_dark_mode_specific_images_from_readme
124+
- name: Publishing on NPM
125+
run: |
126+
if [ "$(npm show . version)" = "$VERSION" ]; then
127+
echo "This version is already published"
128+
exit 0
129+
fi
130+
if [ "$NODE_AUTH_TOKEN" = "" ]; then
131+
echo "Can't publish on NPM, You must first create a secret called NPM_TOKEN that contains your NPM auth token. https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets"
132+
false
133+
fi
134+
EXTRA_ARGS=""
135+
if [ "$IS_PRE_RELEASE" = "true" ]; then
136+
EXTRA_ARGS="--tag next"
137+
fi
138+
npm publish $EXTRA_ARGS
139+
env:
140+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
141+
VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }}
142+
IS_PRE_RELEASE: ${{ needs.check_if_version_upgraded.outputs.is_pre_release }}

0 commit comments

Comments
 (0)