chore: prepare for cli 0.10.12 release #8
Workflow file for this run
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
| name: Publish CLI | |
| on: | |
| push: | |
| tags: | |
| - "cli-*" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: publish-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| prepare: | |
| if: github.repository == 'eclipse-openvsx/openvsx' | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| release-tag: ${{ steps.context.outputs.RELEASE_TAG }} | |
| release-version: ${{ steps.context.outputs.RELEASE_VERSION }} | |
| project-version: ${{ steps.context.outputs.PROJECT_VERSION }} | |
| npm-tag: ${{ steps.context.outputs.NPM_TAG }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - name: "Setup context" | |
| id: context | |
| shell: bash | |
| env: | |
| REF: ${{ github.ref }} | |
| REF_NAME: ${{ github.ref_name }} | |
| run: | | |
| echo "RELEASE_TAG=${REF_NAME}" >> $GITHUB_OUTPUT | |
| VERSION=$(echo ${REF_NAME} | sed 's/cli-//') | |
| echo "RELEASE_VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| PROJECT_VERSION=$(jq -r .version cli/package.json) | |
| echo "PROJECT_VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| # if the tag contains '-rc', build and publish a release candidate | |
| if [[ "${REF_NAME}" =~ ^.*-rc.* ]]; then | |
| echo "NPM_TAG=next" >> $GITHUB_OUTPUT | |
| else | |
| echo "NPM_TAG=latest" >> $GITHUB_OUTPUT | |
| if [[ "${VERSION}" != "${PROJECT_VERSION}" ]]; then | |
| echo "Project version '${PROJECT_VERSION}' does not match version from tag '${VERSION}'." | |
| exit 1 | |
| fi | |
| fi | |
| npm-publish: | |
| name: "Publish to npm" | |
| runs-on: ubuntu-22.04 | |
| needs: ['prepare'] | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: '24.x' | |
| package-manager-cache: false | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install Yarn | |
| working-directory: cli | |
| run: | | |
| corepack enable | |
| corepack prepare yarn@stable --activate | |
| - name: Build CLI | |
| working-directory: cli | |
| env: | |
| VERSION: ${{ needs.prepare.outputs.release-version }} | |
| run: | | |
| # remove root level package.json to avoid workspaces madness | |
| rm ../package.json | |
| yarn install --immutable | |
| npm version ${VERSION} --allow-same-version | |
| yarn run prepare | |
| - name: Publish | |
| working-directory: cli | |
| env: | |
| NPM_TAG: ${{ needs.prepare.outputs.npm-tag }} | |
| run: | | |
| npm publish --provenance --access public --tag ${NPM_TAG} | |
| github-publish: | |
| runs-on: ubuntu-22.04 | |
| needs: ['prepare', 'npm-publish'] | |
| if: ${{ needs.prepare.outputs.npm-tag == 'latest' }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: "Extract release notes" | |
| id: extract-release-notes | |
| uses: ffurrer2/extract-release-notes@273da39a24fb7db106a35526c8162815faffd31d # v3.1.0 | |
| with: | |
| changelog_file: "cli/CHANGELOG.md" | |
| release_notes_file: "cli/RELEASE_NOTES.md" | |
| - name: "Create GitHub release" | |
| # pin to 2.4.2 due to https://github.com/softprops/action-gh-release/issues/703 | |
| uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2 | |
| with: | |
| name: "CLI v${{ needs.prepare.outputs.release-version }}" | |
| tag_name: "${{ needs.prepare.outputs.release-tag }}" | |
| body_path: "cli/RELEASE_NOTES.md" | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: false | |
| make_latest: false |