Skip to content

Commit 142b234

Browse files
committed
chore(ci): use trusted publishing
1 parent 7ce2ce6 commit 142b234

File tree

5 files changed

+129
-127
lines changed

5 files changed

+129
-127
lines changed

.github/actions/nightly-release/action.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ inputs:
1414
npm-tag:
1515
description: 'NPM tag'
1616
required: true
17-
npm-token:
18-
description: 'NPM token'
19-
required: true
2017

2118
outputs:
2219
full-version:
@@ -60,9 +57,10 @@ runs:
6057
shell: bash
6158
- run: pnpm run --filter @vuetify/api-generator build
6259
shell: bash
60+
- run: npm install -g npm@latest
61+
shell: bash
6362
- name: NPM Release
6463
run: |
65-
npm config set //registry.npmjs.org/:_authToken ${NPM_API_KEY:?}
6664
npm publish ./packages/vuetify --tag ${{ inputs.npm-tag }} --access public
6765
shell: bash
6866
env:

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ jobs:
9292
runs-on: ubuntu-24.04
9393
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository_owner == 'vuetifyjs'
9494
environment: production
95+
permissions:
96+
contents: read
97+
id-token: write
9598
steps:
9699
- uses: actions/checkout@v4
97100
with:
@@ -102,9 +105,9 @@ jobs:
102105
path: packages/vuetify
103106
- uses: vuetifyjs/setup-action@master
104107
- run: pnpm build api
108+
- run: npm install -g npm@latest
105109
- name: NPM Release
106110
run: |
107-
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
108111
npm publish ./packages/vuetify --tag $(node ./scripts/parse-npm-tag.js $GITHUB_REF_NAME)
109112
- name: GitHub release
110113
id: create_release

.github/workflows/nightly-pr.yml

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

.github/workflows/nightly-schedule.yml

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

.github/workflows/nightly.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Nightly Release
2+
on:
3+
schedule:
4+
- cron: '0 12 * * *' # 1200 UTC
5+
workflow_dispatch:
6+
inputs:
7+
pr:
8+
description: 'Pull Request number'
9+
required: false
10+
type: string
11+
12+
jobs:
13+
nightly-schedule:
14+
runs-on: ubuntu-24.04
15+
if: ${{ github.event_name == 'schedule' && github.repository_owner == 'vuetifyjs' }}
16+
environment: preview
17+
permissions:
18+
contents: read
19+
id-token: write
20+
strategy:
21+
max-parallel: 1
22+
fail-fast: false
23+
matrix:
24+
branch: [ 'master', 'dev', 'next', 'v2-stable', 'v2-dev' ]
25+
include:
26+
- branch: 'master'
27+
tag: 'latest'
28+
- branch: 'dev'
29+
tag: 'dev'
30+
- branch: 'next'
31+
tag: 'next'
32+
- branch: 'v2-stable'
33+
tag: 'v2-stable'
34+
- branch: 'v2-dev'
35+
tag: 'v2-dev'
36+
steps:
37+
- uses: actions/checkout@v4
38+
with:
39+
ref: ${{ matrix.branch }}
40+
fetch-depth: 0
41+
- run: |
42+
last=$(git show -s --format=%ct HEAD)
43+
now=$(date +%s)
44+
diff=$(($now - $last))
45+
if [ $diff -gt 86400 ]; then
46+
echo "Last commit was more than 24 hours ago, skipping release"
47+
exit 1
48+
fi
49+
- run: echo "RELEASE_ID=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
50+
- uses: ./.github/actions/nightly-release
51+
with:
52+
checkout-repo: ${{ github.repository }}
53+
checkout-ref: ${{ matrix.branch }}
54+
release-id: ${{ matrix.branch }}.${{ env.RELEASE_ID }}
55+
npm-tag: ${{ matrix.tag }}
56+
- uses: actions/checkout@v4
57+
58+
nightly-pr:
59+
runs-on: ubuntu-24.04
60+
if: ${{ github.event_name == 'workflow_dispatch' && github.repository_owner == 'vuetifyjs' }}
61+
environment: preview
62+
permissions:
63+
contents: read
64+
id-token: write
65+
steps:
66+
- uses: actions/checkout@v4
67+
- uses: actions/github-script@v7
68+
with:
69+
script: |
70+
const pr = await github.rest.pulls.get({
71+
owner: context.repo.owner,
72+
repo: context.repo.repo,
73+
pull_number: ${{ github.event.inputs.pr }}
74+
})
75+
core.exportVariable('CHECKOUT_REPO', pr.data.head.repo.full_name)
76+
core.exportVariable('CHECKOUT_REF', pr.data.head.ref)
77+
core.exportVariable('SHORT_SHA', pr.data.head.sha.slice(0, 7))
78+
- id: nightly-release
79+
uses: ./.github/actions/nightly-release
80+
with:
81+
checkout-repo: ${{ env.CHECKOUT_REPO }}
82+
checkout-ref: ${{ env.CHECKOUT_REF }}
83+
release-id: pr-${{ github.event.inputs.pr }}.${{ env.SHORT_SHA }}
84+
npm-tag: pr
85+
- uses: actions/github-script@v7
86+
with:
87+
script: |
88+
const fullVersion = process.env.FULL_VERSION
89+
const pr = await github.rest.issues.createComment({
90+
owner: context.repo.owner,
91+
repo: context.repo.repo,
92+
issue_number: ${{ github.event.inputs.pr }},
93+
body: `:rocket: Nightly release published to [@vuetify/nightly@${fullVersion}](https://www.npmjs.com/package/@vuetify/nightly/v/${fullVersion}).`
94+
})
95+
env:
96+
FULL_VERSION: ${{ steps.nightly-release.outputs.full-version }}
97+
98+
percy:
99+
name: Visual regression tests
100+
runs-on: ubuntu-24.04
101+
if: ${{ github.event_name == 'schedule' && github.repository_owner == 'vuetifyjs' }}
102+
steps:
103+
- uses: actions/checkout@v4
104+
with:
105+
ref: master
106+
fetch-depth: 0
107+
- run: |
108+
last=$(git show -s --format=%ct HEAD)
109+
now=$(date +%s)
110+
diff=$(($now - $last))
111+
if [ $diff -gt 86400 ]; then
112+
echo "Last commit was more than 24 hours ago, skipping tests"
113+
exit 1
114+
fi
115+
- uses: vuetifyjs/setup-action@master
116+
- run: echo "COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
117+
- run: pnpm test:percy
118+
working-directory: ./packages/vuetify
119+
env:
120+
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
121+
PERCY_BRANCH: master
122+
PERCY_TARGET_BRANCH: master
123+
PERCY_COMMIT: ${{ env.COMMIT }}

0 commit comments

Comments
 (0)