ci: cleanup & fix repo

This commit is contained in:
三咲智子 Kevin Deng 2024-09-17 10:39:36 +08:00
parent 594cb1412d
commit daf098ef68
No known key found for this signature in database
8 changed files with 13 additions and 181 deletions

View File

@ -14,29 +14,3 @@ jobs:
test:
if: ${{ ! startsWith(github.event.head_commit.message, 'release:') && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) }}
uses: ./.github/workflows/test.yml
continuous-release:
if: github.repository == 'vuejs/core'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- name: Install deps
run: pnpm install
- name: Build
run: pnpm build --withTypes
- name: Release
run: pnpx pkg-pr-new publish --compact --pnpm './packages/*'

View File

@ -9,7 +9,7 @@ permissions:
jobs:
close-issues:
if: github.repository == 'vuejs/core'
if: github.repository == 'vuejs/core-vapor'
runs-on: ubuntu-latest
steps:
- name: can't reproduce

View File

@ -1,90 +0,0 @@
name: ecosystem-ci trigger
on:
issue_comment:
types: [created]
jobs:
trigger:
runs-on: ubuntu-latest
if: github.repository == 'vuejs/core' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/ecosystem-ci run')
steps:
- name: Check user permission
uses: actions/github-script@v7
with:
script: |
const user = context.payload.sender.login
console.log(`Validate user: ${user}`)
let isVuejsMember = false
try {
const { status } = await github.rest.orgs.checkMembershipForUser({
org: 'vuejs',
username: user
});
isVuejsMember = (status === 204)
} catch (e) {}
if (isVuejsMember) {
console.log('Allowed')
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: '+1',
})
} else {
console.log('Not allowed')
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: '-1',
})
throw new Error('not allowed')
}
- name: Get PR info
uses: actions/github-script@v7
id: get-pr-data
with:
script: |
console.log(`Get PR info: ${context.repo.owner}/${context.repo.repo}#${context.issue.number}`)
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
})
return {
num: context.issue.number,
branchName: pr.head.ref,
repo: pr.head.repo.full_name,
commit: pr.head.sha
}
- name: Trigger run
uses: actions/github-script@v7
id: trigger
env:
COMMENT: ${{ github.event.comment.body }}
with:
github-token: ${{ secrets.ECOSYSTEM_CI_ACCESS_TOKEN }}
result-encoding: string
script: |
const comment = process.env.COMMENT.trim()
const prData = ${{ steps.get-pr-data.outputs.result }}
const suite = comment.replace(/^\/ecosystem-ci run/, '').trim()
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: 'ecosystem-ci',
workflow_id: 'ecosystem-ci-from-pr.yml',
ref: 'main',
inputs: {
prNumber: '' + prData.num,
branchName: prData.branchName,
repo: prData.repo,
suite: suite === '' ? '-' : suite,
commit: prData.commit
}
})

View File

@ -9,7 +9,7 @@ permissions:
jobs:
action:
if: github.repository == 'vuejs/core'
if: github.repository == 'vuejs/core-vapor'
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v5

View File

@ -1,55 +0,0 @@
name: Release
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
test:
uses: ./.github/workflows/test.yml
release:
# prevents this action from running on forks
if: github.repository == 'vuejs/core'
needs: [test]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
# Use Release environment for deployment protection
environment: Release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- name: Install deps
run: pnpm install
- name: Build and publish
id: publish
run: |
pnpm release --publishOnly
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub release
id: release_tag
uses: yyx990803/release-tag@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
body: |
For stable releases, please refer to [CHANGELOG.md](https://github.com/vuejs/core/blob/main/CHANGELOG.md) for details.
For pre-releases, please refer to [CHANGELOG.md](https://github.com/vuejs/core/blob/minor/CHANGELOG.md) of the `minor` branch.

View File

@ -18,7 +18,7 @@ env:
jobs:
upload:
if: github.repository == 'vuejs/core'
if: github.repository == 'vuejs/core-vapor'
runs-on: ubuntu-latest
steps:

View File

@ -18,7 +18,7 @@ jobs:
size-report:
runs-on: ubuntu-latest
if: >
github.repository == 'vuejs/core' &&
github.repository == 'vuejs/core-vapor' &&
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:

View File

@ -54,17 +54,19 @@ jobs:
- name: Run type declaration tests
run: pnpm run test-dts
release:
continuous-release:
if: github.repository == 'vuejs/core-vapor'
runs-on: ubuntu-latest
needs: [unit-test, lint-and-test-dts]
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4.0.0
uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
@ -73,10 +75,11 @@ jobs:
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- run: pnpm install
- name: Install deps
run: pnpm install
- name: Build
run: pnpm build --withTypes
- name: Publish
run: pnpm dlx pkg-pr-new@0.0 publish './packages/*' --template './playground' --pnpm
- name: Release
run: pnpx pkg-pr-new publish --pnpm './packages/*' --template './playground'