-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
100 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
cache: | ||
description: "(boolean) use actions/cache" | ||
required: false | ||
default: true | ||
type: boolean | ||
node_version: | ||
description: "(string) " | ||
required: false | ||
default: "lts/*" | ||
type: string | ||
runs_on: | ||
description: "(string) " | ||
required: false | ||
default: "ubuntu-latest" | ||
type: string | ||
|
||
env: | ||
CI: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ inputs.runs_on }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: "recursive" | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node_version }} | ||
|
||
- uses: pnpm/action-setup@v2 | ||
name: Install pnpm | ||
with: | ||
version: 8 | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
if: ${{ inputs.cache }} | ||
with: | ||
path: | | ||
${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install Dependencies | ||
run: pnpm i | ||
|
||
- name: Build | ||
run: | | ||
pnpm esb | ||
- name: pack | ||
run: | | ||
npm pack | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
retention-days: 1 | ||
compression-level: 1 | ||
name: artifact | ||
path: | | ||
bin | ||
*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,8 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: "recursive" | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
|
@@ -56,9 +58,12 @@ jobs: | |
run: | | ||
pnpm run lint | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
|
||
test-ve: | ||
needs: build | ||
runs-on: ${{ matrix.os }} | ||
name: test (${{ matrix.pm }}, ${{ matrix.os }}) | ||
services: | ||
verdaccio: | ||
image: verdaccio/verdaccio:5 | ||
|
@@ -75,40 +80,28 @@ jobs: | |
with: | ||
submodules: "recursive" | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: artifact | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
|
||
- uses: pnpm/action-setup@v2 | ||
name: Install pnpm | ||
if: ${{ matrix.pm == 'pnpm' }} | ||
with: | ||
version: 8 | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
with: | ||
path: | | ||
${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install Dependencies | ||
run: pnpm i | ||
- name: login to 'verdaccio' | ||
run: npx npm-cli-login -u test -p 1234 -e [email protected] -r http://localhost:4873 | ||
|
||
- name: build | ||
- name: version for 'verdaccio' | ||
run: | | ||
pnpm esb | ||
npm version patch --commit-hooks false --git-tag-version false | ||
- name: login to verdaccio | ||
run: npx npm-cli-login -u test -p 1234 -e [email protected] -r http://localhost:4873 | ||
|
||
- name: publish to verdaccio | ||
- name: publish to 'verdaccio' | ||
run: | | ||
npm publish --registry http://localhost:4873 | ||
|
@@ -124,8 +117,8 @@ jobs: | |
${{ matrix.pm }} create hexo | ||
test-ln: | ||
needs: build | ||
runs-on: ${{ matrix.os }} | ||
name: test (${{ matrix.pm }}, ${{ matrix.os }}) | ||
strategy: | ||
matrix: | ||
os: [windows-latest, macos-latest] | ||
|
@@ -134,8 +127,12 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
# with: | ||
# submodules: "recursive" | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
submodules: "recursive" | ||
name: artifact | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
|
@@ -145,31 +142,21 @@ jobs: | |
name: Install pnpm | ||
with: | ||
version: 8 | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
if: ${{ inputs.cache }} | ||
with: | ||
path: | | ||
${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install Dependencies | ||
run: pnpm i | ||
|
||
- name: build | ||
run: | | ||
pnpm esb | ||
- name: pack | ||
run: | | ||
npm pack | ||
run: pnpm add @actions/core -D | ||
|
||
- name: config for test | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { readFileSync } from "node:fs"; | ||
import * as core from "@actions/core"; | ||
import { exportVariable } from "@actions/core"; | ||
const { version } = JSON.parse(readFileSync("package.json")); | ||
console.info(version); | ||
core.exportVariable("version", version); | ||
// process.stdout.write(`::set-env name=version::${version}`); | ||
exportVariable("version", version); |