From 695a9e6e52faf21670bbd221a9407952bcd476cd Mon Sep 17 00:00:00 2001 From: Yiyi Wang Date: Thu, 14 Sep 2023 12:40:06 +0800 Subject: [PATCH] Set up CI job to publish the vscode extension (#1759) * ci: Set up CI job to publish the vscode extension * ci: Fixed test.yml --- .github/workflows/release.yml | 52 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 3 +- .vscodeignore | 4 ++- 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..59063e3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +name: "Publish the extension." +on: + push: + branches: + - master + - develop +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: 'Install nodejs 18' + uses: actions/setup-node@v2 + with: + node-version: '18' + - name: Install dependencies + run: | + corepack enable + yarn install + - name: Build + run: yarn run build + - name: Get current package version + id: package_version + uses: martinbeentjes/npm-get-version-action@v1.1.0 + - name: Publish extension to Visual Studio Marketplace + id: create_vsix + uses: HaaLeo/publish-vscode-extension@v1 + with: + dryRun: ${{ github.ref != 'refs/heads/master' }} + pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} + registryUrl: https://marketplace.visualstudio.com + - name: Create a Release + if: github.ref == 'refs/heads/master' + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name : ${{ steps.package_version.outputs.current-version}} + release_name: ${{ steps.package_version.outputs.current-version}} + body: Published ${{ steps.package_version.outputs.current-version}} + - name: Attach vsix to release + if: github.ref == 'refs/heads/master' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ steps.create_vsix.outputs.vsixPath}} + asset_name: ${{ steps.create_vsix.outputs.vsixPath}} + asset_content_type: application/vsix \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5a08715..2ffadcb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,9 +3,10 @@ on: push: branches: - master + - develop pull_request: branches: - - master + - develop concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.vscodeignore b/.vscodeignore index 2c227b8..1d83a33 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -18,4 +18,6 @@ node_modules .prettierignore build.js prettier.config.js -.eslintrc.js \ No newline at end of file +.eslintrc.js +.husky +gulpfile.js \ No newline at end of file