Skip to content

Commit 2a8e43a

Browse files
authored
chore(workflows): refactor github workflows for new npm auth (#1486)
1 parent a9d1b7e commit 2a8e43a

File tree

5 files changed

+46
-31
lines changed

5 files changed

+46
-31
lines changed

.github/workflows/actions/publish-npm/action.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ inputs:
1010
folder:
1111
default: './'
1212
description: 'A folder containing a package.json file.'
13-
token:
14-
description: 'The NPM authentication token required to publish.'
15-
1613
createRelease:
1714
description: 'Create a release on GitHub.'
1815
default: 'false'
19-
2016
ghToken:
2117
description: 'The GitHub authentication token required to create a release.'
2218

@@ -49,12 +45,6 @@ runs:
4945
run: npm run build
5046
shell: bash
5147
working-directory: ${{ inputs.working-directory }}
52-
- name: Prepare NPM Token
53-
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
54-
working-directory: ${{ inputs.working-directory }}
55-
shell: bash
56-
env:
57-
NPM_TOKEN: ${{ inputs.token }}
5848
- name: Publish to NPM
5949
run: npm publish ${{ inputs.folder }} --tag ${{ inputs.tag }} --provenance
6050
shell: bash
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name: 'Ionicons Dev Build'
1+
name: 'Dev Release'
22

33
on:
4-
workflow_dispatch:
4+
workflow_call:
55

66
jobs:
77
create-dev-hash:
@@ -33,7 +33,6 @@ jobs:
3333
tag: dev
3434
version: ${{ needs.create-dev-hash.outputs.dev-hash }}
3535
working-directory: './'
36-
token: ${{ secrets.NPM_TOKEN }}
3736
createRelease: 'false'
3837

3938
get-build:
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
1-
name: 'Ionicons Production Release'
1+
name: 'Production Release'
22

33
on:
4-
workflow_dispatch:
4+
workflow_call:
55
inputs:
66
version:
7-
required: true
8-
type: choice
9-
description: Which version should be published?
10-
options:
11-
- patch
12-
- minor
13-
- major
14-
tag:
15-
required: true
16-
type: choice
17-
description: Which npm tag should this be published to?
18-
options:
19-
- latest
7+
required: false
8+
type: string
9+
description: npm version (major, minor, or patch)
2010

2111
jobs:
2212
release-ionicons:
@@ -31,9 +21,8 @@ jobs:
3121
- name: Publish to NPM
3222
uses: ./.github/workflows/actions/publish-npm
3323
with:
34-
tag: ${{ inputs.tag }}
24+
tag: latest
3525
version: ${{ inputs.version }}
3626
working-directory: './'
37-
token: ${{ secrets.NPM_TOKEN }}
3827
createRelease: true
3928
ghToken: ${{ secrets.IONITRON_TOKEN }}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 'Release Orchestrator'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release-type:
7+
description: 'Release type'
8+
required: true
9+
type: choice
10+
options:
11+
- dev
12+
- production
13+
version:
14+
description: 'Version for production releases'
15+
required: false
16+
type: choice
17+
options:
18+
- patch
19+
- minor
20+
- major
21+
22+
permissions:
23+
id-token: write
24+
contents: read
25+
26+
jobs:
27+
run-dev:
28+
if: ${{ inputs.release-type == 'dev' }}
29+
uses: ./.github/workflows/dev-release.yml
30+
secrets: inherit
31+
32+
run-production:
33+
if: ${{ inputs.release-type == 'production' }}
34+
uses: ./.github/workflows/production-release.yml
35+
secrets: inherit
36+
with:
37+
version: ${{ inputs.version }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Ionicons Build'
1+
name: 'Validation'
22

33
on:
44
pull_request:

0 commit comments

Comments
 (0)