Skip to content

Commit 57921bd

Browse files
committed
Apply orchestrator method for npm trusted publishers
1 parent 4c78d5a commit 57921bd

File tree

6 files changed

+122
-58
lines changed

6 files changed

+122
-58
lines changed

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

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/workflows/dev-build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: 'Ionic Dev Build'
22

33
on:
44
workflow_dispatch:
5+
workflow_call:
6+
7+
permissions:
8+
contents: read
9+
id-token: write
510

611
jobs:
712
create-dev-hash:

.github/workflows/nightly.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
# Run every Monday-Friday
66
# at 6:00 UTC (6:00 am UTC)
77
- cron: '00 06 * * 1-5'
8+
workflow_call:
9+
10+
permissions:
11+
contents: read
12+
id-token: write
813

914
jobs:
1015
create-nightly-hash:

.github/workflows/publish-npm.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ runs:
2626
with:
2727
node-version: ${{ inputs.node-version }}
2828
registry-url: 'https://registry.npmjs.org'
29+
scope: '@ionic'
2930
# Provenance requires npm 9.5.0+
3031
- name: 📦 Install latest npm
3132
run: npm install -g npm@latest
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: 'Ionic Release'
2+
3+
on:
4+
schedule:
5+
# Run every Monday-Friday
6+
# at 6:00 UTC (6:00 am UTC)
7+
- cron: '00 06 * * 1-5'
8+
workflow_dispatch:
9+
inputs:
10+
release-type:
11+
description: 'Which Ionic release workflow should run?'
12+
required: true
13+
type: choice
14+
default: nightly
15+
options:
16+
- dev
17+
- nightly
18+
- production
19+
version:
20+
description: 'Which version should be published? (Only for production releases)'
21+
required: false
22+
type: choice
23+
options:
24+
- patch
25+
- minor
26+
- major
27+
- prepatch
28+
- preminor
29+
- premajor
30+
- prerelease
31+
tag:
32+
description: 'Which npm tag should this be published to? (Only for production releases)'
33+
required: false
34+
type: choice
35+
default: latest
36+
options:
37+
- latest
38+
- next
39+
preid:
40+
description: 'Which prerelease identifier should be used? (Only for production releases)'
41+
required: false
42+
type: choice
43+
default: ''
44+
options:
45+
- ''
46+
- alpha
47+
- beta
48+
- rc
49+
- next
50+
51+
permissions:
52+
contents: read
53+
id-token: write
54+
55+
jobs:
56+
run-nightly:
57+
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.release-type == 'nightly') }}
58+
uses: ./.github/workflows/nightly.yml
59+
secrets: inherit
60+
61+
run-dev:
62+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.release-type == 'dev' }}
63+
uses: ./.github/workflows/dev-build.yml
64+
secrets: inherit
65+
66+
run-production:
67+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.release-type == 'production' }}
68+
uses: ./.github/workflows/release.yml
69+
secrets: inherit
70+
with:
71+
version: ${{ inputs.version }}
72+
tag: ${{ inputs.tag }}
73+
preid: ${{ inputs.preid }}

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,47 @@ on:
3232
- beta
3333
- rc
3434
- next
35+
workflow_call:
36+
inputs:
37+
version:
38+
description: 'Which version should be published?'
39+
required: true
40+
type: string
41+
tag:
42+
description: 'Which npm tag should this be published to?'
43+
required: true
44+
type: string
45+
preid:
46+
description: 'Which prerelease identifier should be used? This is only needed when version is "prepatch", "preminor", "premajor", or "prerelease".'
47+
required: false
48+
type: string
49+
50+
permissions:
51+
contents: read
52+
id-token: write
3553

3654
jobs:
55+
validate_version:
56+
name: ✅ Validate Version Input
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: 🔎 Ensure version is allowed
60+
env:
61+
VERSION: ${{ inputs.version }}
62+
run: |
63+
case "$VERSION" in
64+
patch|minor|major|prepatch|preminor|premajor|prerelease)
65+
exit 0
66+
;;
67+
*)
68+
echo "::error::Invalid version input: '$VERSION'. Allowed values: patch, minor, major, prepatch, preminor, premajor, prerelease."
69+
exit 1
70+
;;
71+
esac
72+
shell: bash
73+
3774
release-ionic:
75+
needs: [validate_version]
3876
permissions:
3977
contents: read
4078
id-token: write

0 commit comments

Comments
 (0)