refactor: 优化打印语句 #12
Workflow file for this 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
name: Publish to VSCode Store | |
on: | |
push: | |
tags: | |
- '*' | |
# release: | |
# types: | |
# - published | |
workflow_dispatch: | |
jobs: | |
package-publish: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- run: npm i -g @vscode/vsce pnpm ovsx | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
id: cache | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm- | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: pnpm i --frozen-lockfile --ignore-scripts | |
- name: Publish | |
env: | |
VSCODE_PUBLISH_TOKEN: ${{ secrets.VSCODE_PUBLISH_TOKEN }} | |
OPENVSX_PUBLISH_TOKEN: ${{ secrets.OPENVSX_PUBLISH_TOKEN }} | |
run: | | |
vsce package --no-dependencies | |
vsce publish --no-dependencies -p $VSCODE_PUBLISH_TOKEN | |
ovsx publish --no-dependencies -p $OPENVSX_PUBLISH_TOKEN | |
# - name: Upload assets | |
# uses: softprops/action-gh-release@v1 | |
# if: startsWith(github.ref, 'refs/tags/') | |
# with: | |
# files: '*.vsix' | |
- run: | | |
# 使用sed命令提取最新的版本记录 | |
cat CHANGELOG.md | awk '/^# \[/ {if (flag) exit; flag=1} flag {print}' > body.md | |
- name: Publish release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: '*.vsix' | |
bodyFile: 'body.md' |