Skip to content

Commit bb54746

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

File tree

5 files changed

+130
-127
lines changed

5 files changed

+130
-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: write
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: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
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+
pull-requests: write
66+
steps:
67+
- uses: actions/checkout@v4
68+
- uses: actions/github-script@v7
69+
with:
70+
script: |
71+
const pr = await github.rest.pulls.get({
72+
owner: context.repo.owner,
73+
repo: context.repo.repo,
74+
pull_number: ${{ github.event.inputs.pr }}
75+
})
76+
core.exportVariable('CHECKOUT_REPO', pr.data.head.repo.full_name)
77+
core.exportVariable('CHECKOUT_REF', pr.data.head.ref)
78+
core.exportVariable('SHORT_SHA', pr.data.head.sha.slice(0, 7))
79+
- id: nightly-release
80+
uses: ./.github/actions/nightly-release
81+
with:
82+
checkout-repo: ${{ env.CHECKOUT_REPO }}
83+
checkout-ref: ${{ env.CHECKOUT_REF }}
84+
release-id: pr-${{ github.event.inputs.pr }}.${{ env.SHORT_SHA }}
85+
npm-tag: pr
86+
- uses: actions/github-script@v7
87+
with:
88+
script: |
89+
const fullVersion = process.env.FULL_VERSION
90+
const pr = await github.rest.issues.createComment({
91+
owner: context.repo.owner,
92+
repo: context.repo.repo,
93+
issue_number: ${{ github.event.inputs.pr }},
94+
body: `:rocket: Nightly release published to [@vuetify/nightly@${fullVersion}](https://www.npmjs.com/package/@vuetify/nightly/v/${fullVersion}).`
95+
})
96+
env:
97+
FULL_VERSION: ${{ steps.nightly-release.outputs.full-version }}
98+
99+
percy:
100+
name: Visual regression tests
101+
runs-on: ubuntu-24.04
102+
if: ${{ github.event_name == 'schedule' && github.repository_owner == 'vuetifyjs' }}
103+
steps:
104+
- uses: actions/checkout@v4
105+
with:
106+
ref: master
107+
fetch-depth: 0
108+
- run: |
109+
last=$(git show -s --format=%ct HEAD)
110+
now=$(date +%s)
111+
diff=$(($now - $last))
112+
if [ $diff -gt 86400 ]; then
113+
echo "Last commit was more than 24 hours ago, skipping tests"
114+
exit 1
115+
fi
116+
- uses: vuetifyjs/setup-action@master
117+
- run: echo "COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
118+
- run: pnpm test:percy
119+
working-directory: ./packages/vuetify
120+
env:
121+
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
122+
PERCY_BRANCH: master
123+
PERCY_TARGET_BRANCH: master
124+
PERCY_COMMIT: ${{ env.COMMIT }}

0 commit comments

Comments
 (0)