Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set lerna version back before publishing pypi package to fix version output #256

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ jobs:

- run: ./pw pdm install

- name: activate pyprojectx context
run: realpath ./.pyprojectx/main >> $GITHUB_PATH
# using relative path for npm scripts because it needs to work in the package directories too
- name: add pyprojectx and npm scripts to PATH

run: |
realpath ./.pyprojectx/main >> $GITHUB_PATH
echo ./node_modules/.bin >> $GITHUB_PATH

- id: current-version
run: |
Expand All @@ -43,9 +47,9 @@ jobs:
id: version-was-changed
working-directory: ${{ env.NPM_PACKAGE_DIR }}

- name: set version for publishing
- name: set version for npm packages
if: github.ref == 'refs/heads/main'
run: ./node_modules/.bin/lerna version ${{ steps.current-version.outputs.CURRENT_VERSION }} --yes --no-git-tag-version
run: lerna version ${{ steps.current-version.outputs.CURRENT_VERSION }} --yes --no-git-tag-version

- name: Build VSIX
working-directory: ${{ env.VSIX_DIR }}
Expand Down Expand Up @@ -81,19 +85,25 @@ jobs:
access: public
package: ${{ env.NPM_PACKAGE_DIR }}/package.json

# this isn't ideal, but it's required becayse pdm publish re-builds the npm packages even tho they were already built earlier.
# i think to fix that i need to rewrite pdm_build.py to use the build hooks so we can control it more easily, but i can't get that to work soooo
- name: set npm package versions back to upstream so pypi package can use it in --version output
if: github.ref == 'refs/heads/main'
run: lerna version ${{ steps.current-version.outputs.CURRENT_UPSTREAM_VERSION }} --yes --no-git-tag-version

- name: publish package - pypi
if: github.ref == 'refs/heads/main' && steps.version-was-changed.outputs.VERSION_INFO == ''
run: pdm publish

# https://code.visualstudio.com/api/working-with-extensions/publishing-extension#get-a-personal-access-token
- name: publish VSIX - visual studio marketplace
if: github.ref == 'refs/heads/main' && steps.version-was-changed.outputs.VERSION_INFO == ''
run: ./node_modules/.bin/vsce publish --packagePath ${{ env.VSIX_NAME }} --pat ${{ secrets.VSCE_TOKEN }} --noVerify
run: vsce publish --packagePath ${{ env.VSIX_NAME }} --pat ${{ secrets.VSCE_TOKEN }} --noVerify
working-directory: ${{ env.VSIX_DIR }}

- name: publish VSIX - open VSX
if: github.ref == 'refs/heads/main' && steps.version-was-changed.outputs.VERSION_INFO == ''
run: ./node_modules/.bin/ovsx publish --packagePath ${{ env.VSIX_NAME }} --pat ${{ secrets.OPEN_VSX_TOKEN }}
run: ovsx publish --packagePath ${{ env.VSIX_NAME }} --pat ${{ secrets.OPEN_VSX_TOKEN }}
working-directory: ${{ env.VSIX_DIR }}

- uses: marvinpinto/action-automatic-releases@v1.2.1
Expand Down
Loading