diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc615d4..f36301d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,3 +1,4 @@ +name: build on: workflow_call: inputs: @@ -18,46 +19,31 @@ on: type: string env: - CI: true + default_node_version: "lts/*" jobs: build: + name: 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@v4 - name: Setup pnpm cache - if: ${{ inputs.cache }} + - uses: actions/setup-node@v4 with: - path: | - ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + node-version: ${{ inputs.node_version }} + cache: pnpm - name: Install Dependencies run: pnpm i - name: Build run: | - pnpm esb + pnpm run build - name: get hexo-starter hash shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75b7bdd..2af2c1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,50 +18,58 @@ on: - ".github/workflows/ci.yml" env: - CI: true + default_node_version: "lts/*" jobs: lint: + name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: "recursive" - - uses: actions/setup-node@v4 - with: - node-version: "lts/*" - - uses: pnpm/action-setup@v2 name: Install pnpm + + - uses: actions/setup-node@v4 with: - version: 8 + node-version: ${{env.default_node_version}} + cache: pnpm + + - name: Install Dependencies + run: pnpm i - - name: Get pnpm store directory - shell: bash + - name: Lint run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + pnpm run lint - - uses: actions/cache@v4 - name: Setup pnpm cache + type: + name: Type Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v2 + name: Install pnpm + + - uses: actions/setup-node@v4 with: - path: | - ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + node-version: ${{env.default_node_version}} + cache: pnpm - name: Install Dependencies run: pnpm i - name: Lint run: | - pnpm run lint + pnpm run lint:type build: uses: ./.github/workflows/build.yml test-ve: + name: test-ve needs: build runs-on: ${{ matrix.os }} services: @@ -84,15 +92,13 @@ jobs: with: name: artifact - - uses: actions/setup-node@v4 - with: - node-version: "lts/*" - - uses: pnpm/action-setup@v2 name: Install pnpm if: ${{ matrix.pm == 'pnpm' }} + + - uses: actions/setup-node@v4 with: - version: 8 + node-version: ${{env.default_node_version}} - name: login to 'verdaccio' run: npx npm-cli-login -u test -p 1234 -e test@domain.test -r http://localhost:4873 @@ -117,6 +123,7 @@ jobs: ${{ matrix.pm }} create hexo test-ln: + name: test-ln needs: build runs-on: ${{ matrix.os }} strategy: @@ -134,15 +141,13 @@ jobs: with: name: artifact - - uses: actions/setup-node@v4 - with: - node-version: "lts/*" - - uses: pnpm/action-setup@v2 name: Install pnpm if: ${{ matrix.pm == 'pnpm' }} + + - uses: actions/setup-node@v4 with: - version: 8 + node-version: ${{env.default_node_version}} - name: config for test run: | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c8d53a7..42cb268 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: inputs: version: - description: "the package version you want to bump" + description: "" required: true default: "keep current" type: choice @@ -18,8 +18,12 @@ on: tags: - "v*.*.*" +env: + default_node_version: "lts/*" + jobs: build: + name: build uses: ./.github/workflows/build.yml publish-npm: @@ -79,3 +83,18 @@ jobs: - run: npm publish --access public --registry=https://npm.pkg.github.com env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + + release: + name: Release + needs: publish-npm + runs-on: ubuntu-latest + permissions: + contents: write + discussions: write + steps: + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + generate_release_notes: true + discussion_category_name: "Announcements"