Version Packages (#5) #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| push: | |
| branches: | |
| - main | |
| name: Deploy | |
| jobs: | |
| deploy-packages: | |
| name: Packages | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'yarn' | |
| - run: yarn install --immutable | |
| - run: yarn build | |
| - name: Create Release Pull Request or Publish to npm | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| publish: yarn changeset:publish | |
| version: yarn changeset:version | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| - name: Upload VSIX to Package-Specific Release | |
| if: steps.changesets.outputs.published == 'true' | |
| shell: bash | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: | | |
| PACKAGE_NAME="urlspec-vscode-extension" | |
| VERSION=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r ".[] | select(.name == \"$PACKAGE_NAME\") | .version") | |
| if [ -n "$VERSION" ] && [ "$VERSION" != "null" ]; then | |
| TAG_NAME="$PACKAGE_NAME@$VERSION" | |
| echo "Target Tag: $TAG_NAME" | |
| cd packages/$PACKAGE_NAME | |
| VSIX_FILE=$(ls *.vsix) | |
| gh release upload "$TAG_NAME" "$VSIX_FILE" --clobber | |
| else | |
| echo "No update for $PACKAGE_NAME in this release." | |
| fi |