forked from jshmrtn/vue3-gettext
-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (91 loc) · 3.28 KB
/
Copy pathrelease-please.yml
File metadata and controls
108 lines (91 loc) · 3.28 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: release-please
on:
push:
branches: [master]
workflow_dispatch:
inputs:
ref:
description: "Release tag to publish (for example, vue3-gettext-v4.3.3)"
required: true
type: string
dist_tag:
description: "npm dist-tag; infer uses next for prereleases and latest otherwise"
required: true
default: "infer"
type: choice
options:
- infer
- latest
- next
permissions:
contents: write
pull-requests: write
id-token: write
concurrency:
group: release-please
cancel-in-progress: false
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Release Please
if: github.event_name == 'push'
id: rp
uses: googleapis/release-please-action@v5
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
# npm trusts this workflow filename, so automatic releases and manual
# recovery publishes must both run here.
- name: Checkout
if: github.event_name == 'workflow_dispatch' || steps.rp.outputs.release_created == 'true'
uses: actions/checkout@v7
with:
ref: ${{ inputs.ref || steps.rp.outputs.tag_name }}
- name: Setup Node
if: github.event_name == 'workflow_dispatch' || steps.rp.outputs.release_created == 'true'
uses: actions/setup-node@v7
with:
node-version: 24
registry-url: "https://registry.npmjs.org"
package-manager-cache: false
- name: Install system deps
if: github.event_name == 'workflow_dispatch' || steps.rp.outputs.release_created == 'true'
run: |
sudo apt-get update
sudo apt-get install -y gettext
- name: Install deps
if: github.event_name == 'workflow_dispatch' || steps.rp.outputs.release_created == 'true'
run: npm ci
- name: Test
if: github.event_name == 'workflow_dispatch' || steps.rp.outputs.release_created == 'true'
run: npm test
- name: Build
if: github.event_name == 'workflow_dispatch' || steps.rp.outputs.release_created == 'true'
run: npm run build
- name: Publish
if: github.event_name == 'workflow_dispatch' || steps.rp.outputs.release_created == 'true'
run: |
set -euo pipefail
VERSION="$(node -p "require('./package.json').version")"
RELEASE_TAG="${{ inputs.ref || steps.rp.outputs.tag_name }}"
DIST_TAG="${{ inputs.dist_tag }}"
if [[ "$RELEASE_TAG" =~ ^vue3-gettext-v(.+)$ ]]; then
TAG_VERSION="${BASH_REMATCH[1]}"
else
echo "Ref must be a vue3-gettext release tag, received: $RELEASE_TAG" >&2
exit 1
fi
if [[ "$VERSION" != "$TAG_VERSION" ]]; then
echo "package.json version $VERSION does not match release tag $RELEASE_TAG" >&2
exit 1
fi
if [[ -z "$DIST_TAG" || "$DIST_TAG" == "infer" ]]; then
if [[ "$VERSION" == *-* ]]; then
DIST_TAG="next"
else
DIST_TAG="latest"
fi
fi
echo "Publishing version $VERSION to dist-tag: $DIST_TAG with npm trusted publishing"
npm publish --tag "$DIST_TAG"