Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 8f66253

Browse files
committed
chore: update github actions dependencies
1 parent 033d141 commit 8f66253

File tree

5 files changed

+276
-267
lines changed

5 files changed

+276
-267
lines changed

.github/workflows/cd-teardown.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ env:
66
CI: true
77
jobs:
88
unpublish-npm:
9-
runs-on: ubuntu-20.04
9+
runs-on: ubuntu-latest
1010
if: github.event.ref_type == 'branch'
1111
steps:
12-
- name: Prepare for unpublication from npm
13-
uses: actions/setup-node@v2.5.0
14-
with:
15-
node-version: '16.x'
16-
registry-url: 'https://registry.npmjs.org'
17-
- name: Determine npm tag
18-
# Remove non-alphanumeric characters
19-
# See https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
20-
run: echo "TAG_SLUG=$(echo "${{ github.event.ref }}" | tr -cd '[:alnum:]-')" >> $GITHUB_ENV
21-
- name: Remove npm tag for the deleted branch
22-
run: |
23-
export EXISTING_TAGS=$(npm dist-tag ls @inrupt/solid-client | grep --count $TAG_SLUG)
24-
# Unfortunately GitHub Actions does not currently let us do something like
25-
# if: secrets.NPM_TOKEN != ''
26-
# so simply skip the command if the env var is not set:
27-
if [ -n $NODE_AUTH_TOKEN ] && [ $EXISTING_TAGS -eq 1 ]; then npm dist-tag rm @inrupt/solid-client $TAG_SLUG; fi
28-
env:
29-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
30-
- run: echo "Package tag [$TAG_SLUG] unpublished."
12+
- name: Prepare for unpublication from npm
13+
uses: actions/setup-node@v3
14+
with:
15+
node-version: "16.x"
16+
registry-url: "https://registry.npmjs.org"
17+
- name: Determine npm tag
18+
# Remove non-alphanumeric characters
19+
# See https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
20+
run: echo "TAG_SLUG=$(echo "${{ github.event.ref }}" | tr -cd '[:alnum:]-')" >> $GITHUB_ENV
21+
- name: Remove npm tag for the deleted branch
22+
run: |
23+
export EXISTING_TAGS=$(npm dist-tag ls @inrupt/solid-client | grep --count $TAG_SLUG)
24+
# Unfortunately GitHub Actions does not currently let us do something like
25+
# if: secrets.NPM_TOKEN != ''
26+
# so simply skip the command if the env var is not set:
27+
if [ -n $NODE_AUTH_TOKEN ] && [ $EXISTING_TAGS -eq 1 ]; then npm dist-tag rm @inrupt/solid-client $TAG_SLUG; fi
28+
env:
29+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
30+
- run: echo "Package tag [$TAG_SLUG] unpublished."

.github/workflows/cd.yml

Lines changed: 115 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -3,133 +3,134 @@ name: CD
33
on:
44
push:
55
branches:
6-
- '**'
6+
- "**"
77
tags-ignore:
8-
# Only create preview releases for branches
9-
# (the `release` workflow creates actual releases for version tags):
10-
- '**'
8+
# Only create preview releases for branches
9+
# (the `release` workflow creates actual releases for version tags):
10+
- "**"
1111

1212
env:
1313
CI: true
1414
jobs:
1515
prepare-deployment:
16-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-latest
1717
outputs:
1818
tag-slug: ${{ steps.determine-npm-tag.outputs.tag-slug }}
1919
deployment-id: ${{ fromJson(steps.create-deployment.outputs.data || '{}').id || 'Skipped for Dependabot' }}
2020
steps:
21-
- name: Create GitHub Deployment
22-
if: github.actor != 'dependabot[bot]'
23-
id: create-deployment
24-
uses: octokit/[email protected]
25-
with:
26-
route: POST /repos/:repository/deployments
27-
repository: ${{ github.repository }}
28-
ref: ${{ github.sha }}
29-
environment: review
30-
transient_environment: true
31-
auto_merge: false
32-
mediaType: '{"previews": ["flash", "ant-man"]}'
33-
# The deployment runs in parallel with CI, so status checks will never have succeeded yet:
34-
required_contexts: '[]'
35-
env:
36-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
37-
- name: Determine npm tag
38-
if: github.actor != 'dependabot[bot]'
39-
id: determine-npm-tag
40-
run: |
41-
# Remove non-alphanumeric characters
42-
# See https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
43-
echo "::set-output name=tag-slug::$(echo ${GITHUB_REF#refs/heads/} | tr -cd '[:alnum:]-')"
21+
- name: Create GitHub Deployment
22+
if: github.actor != 'dependabot[bot]'
23+
id: create-deployment
24+
uses: octokit/[email protected]
25+
with:
26+
route: POST /repos/:repository/deployments
27+
repository: ${{ github.repository }}
28+
ref: ${{ github.sha }}
29+
environment: review
30+
transient_environment: true
31+
auto_merge: false
32+
mediaType: '{"previews": ["flash", "ant-man"]}'
33+
# The deployment runs in parallel with CI, so status checks will never have succeeded yet:
34+
required_contexts: "[]"
35+
env:
36+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
37+
- name: Determine npm tag
38+
if: github.actor != 'dependabot[bot]'
39+
id: determine-npm-tag
40+
run: |
41+
# Remove non-alphanumeric characters
42+
# See https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
43+
echo "::set-output name=tag-slug::$(echo ${GITHUB_REF#refs/heads/} | tr -cd '[:alnum:]-')"
4444
4545
publish-npm:
46-
runs-on: ubuntu-20.04
46+
runs-on: ubuntu-latest
4747
needs: [prepare-deployment]
4848
outputs:
4949
version-nr: ${{ steps.determine-npm-version.outputs.version-nr }}
5050
steps:
51-
- uses: actions/[email protected]
52-
- name: Mark GitHub Deployment as in progress
53-
if: github.actor != 'dependabot[bot]'
54-
id: start-deployment
55-
uses: octokit/[email protected]
56-
with:
57-
route: POST /repos/:repository/deployments/:deployment/statuses
58-
repository: ${{ github.repository }}
59-
deployment: ${{ needs.prepare-deployment.outputs.deployment-id }}
60-
environment: review
61-
description: "Publishing to npm tag [${{ needs.prepare-deployment.outputs.tag-slug }}]…"
62-
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
63-
state: in_progress
64-
mediaType: '{"previews": ["flash", "ant-man"]}'
65-
env:
66-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
67-
- uses: actions/[email protected]
68-
with:
69-
node-version: '16.x'
70-
registry-url: 'https://registry.npmjs.org'
71-
- name: Prepare prerelease version
72-
if: github.actor != 'dependabot[bot]'
73-
id: determine-npm-version
74-
run: |
75-
git config user.name $GITHUB_ACTOR
76-
git config user.email gh-actions-${GITHUB_ACTOR}@github.com
77-
# Unfortunately re-running a job does not change its run ID nor run number.
78-
# To prevent re-releasing the same version when re-running the CD job,
79-
# we incorporate a timestamp in the prerelease version:
80-
TIMESTAMP=$(date --utc +%s)
81-
# Make sure the prerelease is tagged with the branch name, and that they are sorted by build:
82-
VERSION_NR=$(npm version prerelease --preid=$TAG_SLUG-$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-$TIMESTAMP)
83-
echo "::set-output name=version-nr::$VERSION_NR"
84-
env:
85-
TAG_SLUG: ${{ needs.prepare-deployment.outputs.tag-slug }}
86-
- run: npm ci
87-
- name: Publish an npm tag for this branch
88-
if: github.actor != 'dependabot[bot]'
89-
run: |
90-
# Unfortunately GitHub Actions does not currently let us do something like
91-
# if: secrets.NPM_TOKEN != ''
92-
# so simply skip the command if the env var is not set:
93-
if [ -z $NODE_AUTH_TOKEN ]; then echo "No npm token defined; package not published."; fi
94-
if [ -n $NODE_AUTH_TOKEN ]; then npm publish --access public --tag "$TAG_SLUG"; fi
95-
if [ -n $NODE_AUTH_TOKEN ]; then echo "Package published. To install, run:"; fi
96-
if [ -n $NODE_AUTH_TOKEN ]; then echo ""; fi
97-
if [ -n $NODE_AUTH_TOKEN ]; then echo " npm install @inrupt/solid-ui-react@$TAG_SLUG"; fi
98-
env:
99-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
100-
TAG_SLUG: ${{ needs.prepare-deployment.outputs.tag-slug }}
101-
- name: Mark GitHub Deployment as successful
102-
if: github.actor != 'dependabot[bot]'
103-
uses: octokit/[email protected]
104-
with:
105-
route: POST /repos/:repository/deployments/:deployment/statuses
106-
repository: ${{ github.repository }}
107-
deployment: ${{ needs.prepare-deployment.outputs.deployment-id }}
108-
environment: review
109-
environment_url: 'https://www.npmjs.com/package/@inrupt/solid-ui-react/v/${{ needs.prepare-deployment.outputs.tag-slug }}'
110-
description: "Published to npm. To install, run: npm install @inrupt/solid-ui-react@${{ needs.prepare-deployment.outputs.tag-slug }}"
111-
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
112-
mediaType: '{"previews": ["flash", "ant-man"]}'
113-
state: success
114-
env:
115-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
116-
- name: Mark GitHub Deployment as failed
117-
uses: octokit/[email protected]
118-
if: failure() && github.actor != 'dependabot[bot]'
119-
with:
120-
route: POST /repos/:repository/deployments/:deployment/statuses
121-
repository: ${{ github.repository }}
122-
deployment: ${{ needs.prepare-deployment.outputs.deployment-id }}
123-
environment: review
124-
description: "Publication to npm failed. Review the GitHub Actions log for more information."
125-
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
126-
mediaType: '{"previews": ["flash", "ant-man"]}'
127-
state: failure
128-
env:
129-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
130-
- name: Waiting for npm CDNs to update...
131-
if: github.actor != 'dependabot[bot]'
132-
run: |
133-
echo "Giving npm some time to make the newly-published package available…"
134-
sleep 5m
135-
echo "Done — hopefully that was enough time for the follow-up jobs to install the just-published package, to verify that everything looks OK."
51+
- uses: actions/checkout@v3
52+
- name: Mark GitHub Deployment as in progress
53+
if: github.actor != 'dependabot[bot]'
54+
id: start-deployment
55+
uses: octokit/[email protected]
56+
with:
57+
route: POST /repos/:repository/deployments/:deployment/statuses
58+
repository: ${{ github.repository }}
59+
deployment: ${{ needs.prepare-deployment.outputs.deployment-id }}
60+
environment: review
61+
description: "Publishing to npm tag [${{ needs.prepare-deployment.outputs.tag-slug }}]…"
62+
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
63+
state: in_progress
64+
mediaType: '{"previews": ["flash", "ant-man"]}'
65+
env:
66+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
67+
- uses: actions/setup-node@v3
68+
with:
69+
node-version: "16.x"
70+
registry-url: "https://registry.npmjs.org"
71+
cache: npm
72+
- name: Prepare prerelease version
73+
if: github.actor != 'dependabot[bot]'
74+
id: determine-npm-version
75+
run: |
76+
git config user.name $GITHUB_ACTOR
77+
git config user.email gh-actions-${GITHUB_ACTOR}@github.com
78+
# Unfortunately re-running a job does not change its run ID nor run number.
79+
# To prevent re-releasing the same version when re-running the CD job,
80+
# we incorporate a timestamp in the prerelease version:
81+
TIMESTAMP=$(date --utc +%s)
82+
# Make sure the prerelease is tagged with the branch name, and that they are sorted by build:
83+
VERSION_NR=$(npm version prerelease --preid=$TAG_SLUG-$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-$TIMESTAMP)
84+
echo "::set-output name=version-nr::$VERSION_NR"
85+
env:
86+
TAG_SLUG: ${{ needs.prepare-deployment.outputs.tag-slug }}
87+
- run: npm ci
88+
- name: Publish an npm tag for this branch
89+
if: github.actor != 'dependabot[bot]'
90+
run: |
91+
# Unfortunately GitHub Actions does not currently let us do something like
92+
# if: secrets.NPM_TOKEN != ''
93+
# so simply skip the command if the env var is not set:
94+
if [ -z $NODE_AUTH_TOKEN ]; then echo "No npm token defined; package not published."; fi
95+
if [ -n $NODE_AUTH_TOKEN ]; then npm publish --access public --tag "$TAG_SLUG"; fi
96+
if [ -n $NODE_AUTH_TOKEN ]; then echo "Package published. To install, run:"; fi
97+
if [ -n $NODE_AUTH_TOKEN ]; then echo ""; fi
98+
if [ -n $NODE_AUTH_TOKEN ]; then echo " npm install @inrupt/solid-ui-react@$TAG_SLUG"; fi
99+
env:
100+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
101+
TAG_SLUG: ${{ needs.prepare-deployment.outputs.tag-slug }}
102+
- name: Mark GitHub Deployment as successful
103+
if: github.actor != 'dependabot[bot]'
104+
uses: octokit/[email protected]
105+
with:
106+
route: POST /repos/:repository/deployments/:deployment/statuses
107+
repository: ${{ github.repository }}
108+
deployment: ${{ needs.prepare-deployment.outputs.deployment-id }}
109+
environment: review
110+
environment_url: "https://www.npmjs.com/package/@inrupt/solid-ui-react/v/${{ needs.prepare-deployment.outputs.tag-slug }}"
111+
description: "Published to npm. To install, run: npm install @inrupt/solid-ui-react@${{ needs.prepare-deployment.outputs.tag-slug }}"
112+
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
113+
mediaType: '{"previews": ["flash", "ant-man"]}'
114+
state: success
115+
env:
116+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
117+
- name: Mark GitHub Deployment as failed
118+
uses: octokit/[email protected]
119+
if: failure() && github.actor != 'dependabot[bot]'
120+
with:
121+
route: POST /repos/:repository/deployments/:deployment/statuses
122+
repository: ${{ github.repository }}
123+
deployment: ${{ needs.prepare-deployment.outputs.deployment-id }}
124+
environment: review
125+
description: "Publication to npm failed. Review the GitHub Actions log for more information."
126+
log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
127+
mediaType: '{"previews": ["flash", "ant-man"]}'
128+
state: failure
129+
env:
130+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
131+
- name: Waiting for npm CDNs to update...
132+
if: github.actor != 'dependabot[bot]'
133+
run: |
134+
echo "Giving npm some time to make the newly-published package available…"
135+
sleep 5m
136+
echo "Done — hopefully that was enough time for the follow-up jobs to install the just-published package, to verify that everything looks OK."

.github/workflows/ci.yml

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,45 @@ env:
66
CI: true
77
jobs:
88
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: ${{ matrix.node-version }}
15+
cache: npm
16+
- run: npm ci
17+
- run: npm run audit --production
18+
- run: npm run audit-licenses
19+
- run: npm run build
20+
- name: Upload build artifacts
21+
uses: actions/upload-artifact@v3
22+
with:
23+
name: dist
24+
path: dist
25+
test:
926
runs-on: ${{ matrix.os }}
1027
strategy:
1128
matrix:
1229
# Available OS's: https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
13-
os: [ubuntu-20.04, windows-2019]
14-
node-version: [16.x, 14.x, 12.x]
30+
os: [ubuntu-latest, windows-latest]
31+
node-version: [16.x, 14.x]
1532
steps:
16-
- uses: actions/[email protected]
17-
- name: Use Node.js ${{ matrix.node-version }}
18-
uses: actions/[email protected]
33+
- uses: actions/checkout@v3
34+
- uses: actions/setup-node@v3
1935
with:
2036
node-version: ${{ matrix.node-version }}
21-
- name: Cache node modules
22-
uses: actions/[email protected]
23-
env:
24-
cache-name: cache-node-modules
25-
with:
26-
path: node_modules
27-
key: ${{ runner.os }}-node${{ runner.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
37+
cache: npm
2838
- run: npm ci
39+
- name: Download build artifacts
40+
uses: actions/download-artifact@v3
41+
with:
42+
name: dist
43+
path: dist
2944
- run: npm run lint
3045
- run: npm run test
31-
- run: npm run audit --production
32-
- run: npm run audit-licenses
33-
- run: npm run build
3446
- name: Archive code coverage results
35-
uses: actions/upload-artifact@v2.3.0
47+
uses: actions/upload-artifact@v3
3648
with:
3749
name: code-coverage-report
3850
path: coverage
39-
- name: Archive production artifacts
40-
uses: actions/[email protected]
41-
with:
42-
name: dist
43-
path: dist

0 commit comments

Comments
 (0)