From df9cba7efb31ee0c92b7cc390eb9851edb915c08 Mon Sep 17 00:00:00 2001 From: maxisam <456807+maxisam@users.noreply.github.com.> Date: Tue, 22 Oct 2024 01:24:29 -0500 Subject: [PATCH] refactor: Update CI workflow and publish workflow --- .github/workflows/ci.yml | 7 ++-- .github/workflows/publish.yml | 60 +++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39fef8a..28bebcb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: 🏃CI permissions: contents: write @@ -12,7 +12,10 @@ jobs: test: strategy: matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + os: + - ubuntu-latest + # - macos-latest + # - windows-latest runs-on: ${{ matrix.os }} outputs: GIT_TAG: ${{ steps.set-tag.outputs.GIT_TAG }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..abaa796 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,60 @@ +name: ♨️ Publish + +permissions: + contents: write + +on: +# on tag push + push: + tags: + - "v[0-9]+" + - "v[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+-*" + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get tag from the event + id: get-tag + run: | + echo "GIT_TAG=${{github.ref_name}}" >> $GITHUB_OUTPUT + echo "::notice title=🏷️ Tag::${{ github.ref_name }} @ ${{ github.sha}}" + + - name: Check package.json version is the same as the tag + id: check-version + run: | + if [ "v$(jq -r .version package.json)" != "${{ steps.get-tag.outputs.GIT_TAG }}" ]; then + echo "Version in package.json does not match the tag" + exit 1 + fi + + - uses: pnpm/action-setup@v4 + name: Install pnpm + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Publish to Visual Studio Marketplace + run: pnpm run publish:vs-marketplace + env: + VSCE_PAT: ${{ secrets.VS_MARKETPLACE_TOKEN }} + + # - name: Publish to Open VSX Registry + # run: pnpm run publish:open-vsx -p ${{ secrets.OPEN_VSX_TOKEN }} + + - name: Github Release + run: npx changelogithub + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}