diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index bebe588..e446581 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,14 +1,11 @@ name: Build and Test on: - push: - branches: - - main pull_request: branches: - main workflow_dispatch: - + workflow_call: jobs: build-and-test: runs-on: windows-latest diff --git a/.github/workflows/publish-extension.yml b/.github/workflows/publish-extension.yml new file mode 100644 index 0000000..3045dbb --- /dev/null +++ b/.github/workflows/publish-extension.yml @@ -0,0 +1,57 @@ +name: Publish Extension + +on: + push: + branches: + - main + workflow_dispatch: + +env: + EXTENSION_VERSION: 1.0.${{ github.run_number }} + +jobs: + build-and-test: + uses: ./.github/workflows/build-and-test.yml + + publish-to-marketplace: + needs: build-and-test + runs-on: ubuntu-latest + + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: DocGPT.vsix + path: ./DocGPT.vsix + + - name: Publish to marketplace + uses: cezarypiatek/VsixPublisherAction@1.1 + with: + extension-file: ./DocGPT.vsix + publish-manifest-file: ./DocGpt.Vsix/publishmanifest.json + personal-access-code: ${{ secrets.MARKETPLACE_PAT }} + + publish-release: + needs: build-and-test + runs-on: ubuntu-latest + permissions: write-all + + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: DocGPT.vsix + path: ./DocGPT.vsix + + - name: Create Release + run: | + gh release create --target "${{ github.sha }}" \ + --title "v${{ env.EXTENSION_VERSION }}" \ + --generate-notes + --draft + + - name: Upload Release Asset + run: | + gh release upload "v${{ env.EXTENSION_VERSION }}" \ + --file ./DocGPT.vsix#Installer \ + --clobber