From de232763ecd626dde41c3f232cd8f82e5167a80e Mon Sep 17 00:00:00 2001 From: "J. Lewis" <6710419+lewxdev@users.noreply.github.com> Date: Fri, 15 Mar 2024 18:47:28 -0400 Subject: [PATCH] fix: publish workflow (again) [skip action] (#6) skipping ci in order to trigger manually --- .github/workflows/publish.yml | 63 +++++++++++------------------------ 1 file changed, 19 insertions(+), 44 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 48bfc42..ff8fb66 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,63 +8,38 @@ on: version: description: The version to release (e.g. x.x.x or major, minor, patch) required: false + no-publish: + type: boolean + description: Skip publishing to the marketplace + default: false + +permissions: + contents: write jobs: publish: runs-on: ubuntu-latest steps: - - name: Check it - uses: actions/checkout@v4 - - - name: Prepare it - uses: actions/setup-node@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: lts/* + - run: npm clean-install - - name: Install it - run: npm clean-install - - - name: Version it - if: ${{ github.event_name == 'workflow_dispatch' }} && ${{ github.event.inputs.version }} + - if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version }} run: npm version ${{ github.event.inputs.version }} --no-git-tag-version - - name: Package it - id: package - run: | + - run: | npm exec vsce package - echo "filename=$(ls *.vsix)" >> $GITHUB_OUTPUT + echo "filepath=$(ls *.vsix)" >> $GITHUB_ENV + echo "version=$(npm pkg get version)" >> $GITHUB_ENV + echo "preview=$(npm pkg get preview)" >> $GITHUB_ENV - - name: Publish it + - if: ${{ !github.event.inputs.no-publish }} env: VSCE_PAT: ${{ secrets.VSCE_PAT }} - run: npm exec vsce publish -- --packagePath ${{ steps.package.outputs.filename }} + run: npm exec vsce publish -- --packagePath $filepath - - name: Configure it - id: config - run: | - echo "version=$(node --print "require('./package.json').version")" >> $GITHUB_OUTPUT - echo "preview=$(node --print "require('./package.json').preview")" >> $GITHUB_OUTPUT - - - name: Release it - id: release - uses: actions/create-release@v1 - env: + - env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: v${{ steps.config.outputs.version }} - release_name: v${{ steps.config.outputs.version }} - prerelease: ${{ steps.config.outputs.preview }} - body: | - # v${{ steps.config.outputs.version }} - - see [CHANGELOG.md](CHANGELOG.md) for details on this release - - - name: Upload it - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.release.outputs.upload_url }} - asset_name: ${{ steps.package.outputs.filename }} - asset_path: ${{ steps.package.outputs.filename }} - asset_content_type: application/zip + run: gh release create v$version $filepath --generate-notes --prerelease=$preview