Skip to content

Commit 987d118

Browse files
ci: update pipelines
1 parent a380c95 commit 987d118

4 files changed

Lines changed: 47 additions & 109 deletions

File tree

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ inputs:
1212
description: 'A folder containing a package.json file.'
1313
token:
1414
description: 'The NPM authentication token required to publish.'
15+
16+
createRelease:
17+
description: 'Create a release on GitHub.'
18+
default: 'false'
19+
20+
ghToken:
21+
description: 'The GitHub authentication token required to create a release.'
22+
1523
runs:
1624
using: 'composite'
1725
steps:
@@ -26,7 +34,7 @@ runs:
2634
shell: bash
2735
working-directory: ${{ inputs.working-directory }}
2836
- name: Update Version
29-
run: npm version ${{ inputs.version }} --git-tag-version false
37+
run: npm version ${{ inputs.version }}
3038
shell: bash
3139
working-directory: ${{ inputs.working-directory }}
3240
- name: Run Build
@@ -43,3 +51,15 @@ runs:
4351
run: npm publish ${{ inputs.folder }} --tag ${{ inputs.tag }} --provenance
4452
shell: bash
4553
working-directory: ${{ inputs.working-directory }}
54+
55+
- name: Create Release
56+
if: ${{ inputs.createRelease == 'true' }}
57+
run: |
58+
git config user.name ionitron
59+
git config user.email hi@ionicframework.com
60+
git push origin main --tags
61+
gh auth login --with-token ${{ inputs.ghToken }}
62+
gh release create ${{ inputs.tag }} --title "v${{ inputs.tag }}" --generate-notes
63+
shell: bash
64+
env:
65+
GH_TOKEN: ${{ inputs.ghToken }}

.github/workflows/dev-build.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,21 @@ jobs:
2020
shell: bash
2121

2222
release-ionicons:
23+
runs-on: ubuntu-latest
2324
needs: [create-dev-hash]
24-
uses: ./.github/workflows/release-ionicons.yml
25-
with:
26-
tag: dev
27-
version: ${{ needs.create-dev-hash.outputs.dev-hash }}
28-
secrets:
29-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
25+
permissions:
26+
id-token: write
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Publish to NPM
31+
uses: ./.github/workflows/actions/publish-npm
32+
with:
33+
tag: dev
34+
version: ${{ needs.create-dev-hash.outputs.dev-hash }}
35+
working-directory: './'
36+
token: ${{ secrets.NPM_TOKEN }}
37+
createRelease: 'false'
3038

3139
get-build:
3240
name: Get your dev build!

.github/workflows/release-ionicons.yml

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

.github/workflows/release.yml

Lines changed: 12 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -20,78 +20,18 @@ on:
2020

2121
jobs:
2222
release-ionicons:
23-
uses: ./.github/workflows/release-ionicons.yml
24-
with:
25-
tag: ${{ inputs.tag }}
26-
version: ${{ inputs.version }}
27-
secrets:
28-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29-
30-
finalize-release:
31-
needs: [release-ionicons]
32-
runs-on: ubuntu-latest
33-
steps:
34-
- uses: actions/checkout@v4
35-
with:
36-
token: ${{ secrets.IONITRON_TOKEN }}
37-
fetch-depth: 0
38-
- name: Configure Identity
39-
# Commits from github-actions do not
40-
# trigger other GitHub Actions. As a result,
41-
# we publish releases from Ionitron instead
42-
# so actions run when merging the release branch
43-
# back into main.
44-
run: |
45-
git config user.name ionitron
46-
git config user.email hi@ionicframework.com
47-
shell: bash
48-
# This ensures the local version of Lerna is installed
49-
# and that we do not use the global Lerna version. We currently
50-
# rely on functionality that does not exist in newer versions of Lerna.
51-
- name: Install root dependencies
52-
run: npm ci
53-
shell: bash
54-
- name: Create GitHub Release
55-
run: npx lerna@5 version ${{ inputs.version }} --yes --force-publish='*' --conventional-commits --create-release github
56-
env:
57-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58-
shell: bash
59-
60-
update-package-lock:
61-
# This needs to run after finalize-release
62-
# because we also push to the repo in that
63-
# job. If these jobs ran in parallel then it is
64-
# possible for them to push at the same time.
65-
needs: [finalize-release]
6623
runs-on: ubuntu-latest
24+
permissions:
25+
id-token: write
6726
steps:
68-
- uses: actions/checkout@v4
69-
# Pull the latest version of the reference
70-
# branch instead of the revision that triggered
71-
# the workflow otherwise we won't get the commit
72-
# created in the previous job and this next job
73-
# will fail.
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
- name: Publish to NPM
30+
uses: ./.github/workflows/actions/publish-npm
7431
with:
75-
ref: ${{ github.ref }}
76-
- name: Configure Identity
77-
# Commits from github-actions do not
78-
# trigger other GitHub Actions. As a result,
79-
# we push from Ionitron instead so actions
80-
# run when merging the release branch
81-
# back into main.
82-
run: |
83-
git config user.name ionitron
84-
git config user.email hi@ionicframework.com
85-
shell: bash
86-
# Lerna does not automatically bump versions
87-
# of Ionicons dependencies that have changed,
88-
# so we do that here.
89-
- name: Bump Package Lock
90-
run: |
91-
npx lerna@5 exec "npm install --package-lock-only --legacy-peer-deps"
92-
git add .
93-
git commit -m "chore(): update package lock files"
94-
git push
95-
env:
96-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97-
shell: bash
32+
tag: ${{ inputs.tag }}
33+
version: ${{ inputs.version }}
34+
working-directory: './'
35+
token: ${{ secrets.NPM_TOKEN }}
36+
createRelease: true
37+
ghToken: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)