Repository navigation
72 lines (69 loc) · 2.51 KB
/
Copy pathrelease-migrate.yml
File metadata and controls
72 lines (69 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: 'Release @ionic/migrate'
on:
workflow_call:
inputs:
tag:
description: 'Which npm tag should this be published to?'
required: true
type: string
permissions:
contents: read
id-token: write
jobs:
release-migrate:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/migrate
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: 🟢 Configure Node for Publish
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24.x
registry-url: 'https://registry.npmjs.org'
scope: '@ionic'
cache: 'npm'
cache-dependency-path: packages/migrate/package-lock.json
- name: 📦 Install latest npm
run: npm install -g npm@latest
shell: bash
- name: 🕸️ Install Dependencies
run: npm ci
shell: bash
- name: 🔎 Resolve Version
id: resolve-version
run: |
set -euo pipefail
version="$(node -p "require('./package.json').version")"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Releasing @ionic/migrate@$version to the '${{ inputs.tag }}' tag"
shell: bash
- name: 🚧 Ensure Version Is Unpublished
run: |
set -euo pipefail
version="${{ steps.resolve-version.outputs.version }}"
# `npm view` exits non-zero both for an unpublished version and for a
# package that does not exist yet, and the latter is the expected state
# on the very first release. So inspect stdout rather than the exit
# code: empty output means the version is free to publish.
if [ -n "$(npm view "@ionic/migrate@$version" version 2>/dev/null || true)" ]; then
echo "::error::@ionic/migrate@$version is already published. Bump the version in packages/migrate/package.json."
exit 1
fi
shell: bash
- name: 🔍 Lint
run: npm run lint
shell: bash
- name: 🧪 Test
run: npm test
shell: bash
- name: 🏗️ Run Build
run: npm run build
shell: bash
# `--access public` is not passed here because publishConfig.access in
# package.json already sets it; a scoped package would otherwise default to
# restricted on its first publish.
- name: 🚀 Publish to NPM
run: npm publish --tag ${{ inputs.tag }} --provenance
shell: bash