Release #79
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: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| releaseType: | |
| description: 'Release Type' | |
| required: true | |
| type: choice | |
| default: 'patch' | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| releaseChannel: | |
| description: 'Release Channel' | |
| required: true | |
| type: choice | |
| default: pre | |
| options: | |
| - stable | |
| - pre | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Input parameters | |
| run: echo "${{ toJSON(github.event.inputs) }}" | |
| - name: Clone Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Git | |
| run: | | |
| git config --global user.name "github-actions" | |
| git config --global user.email "szoftverhiba+github-actions@gmail.com" | |
| - name: Get Current Version Number | |
| run: | | |
| CURRENT_VERSION=$(npm pkg get version | cut -d'"' -f 2) | |
| echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV | |
| echo $CURRENT_VERSION | |
| - name: Setup Node version | |
| uses: actions/setup-node@v4 | |
| with: | |
| scope: '@vscode-elements' | |
| node-version: 20 | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| cache-dependency-path: | | |
| package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Bump version (Pre) | |
| run: | | |
| RELEASE_VERSION=$(npx semver -i prerelease --preid=pre $CURRENT_VERSION) | |
| echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
| npm version $RELEASE_VERSION --git-tag-version=false | |
| if: ${{ github.event.inputs.releaseChannel == 'pre' }} | |
| - name: Bump version (Stable) | |
| run: | | |
| RELEASE_VERSION=$(npx semver $CURRENT_VERSION -i ${{ github.event.inputs.releaseType }}) | |
| echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
| npm version $RELEASE_VERSION --git-tag-version=false | |
| if: ${{ github.event.inputs.releaseChannel == 'stable' }} | |
| - name: Update Changelog (Stable) | |
| run: node scripts/update-changelog.mjs | |
| if: ${{ github.event.inputs.releaseChannel == 'stable' }} | |
| - name: Update version number in the base class | |
| run: node scripts/update-version-number.mjs | |
| - name: Build | |
| run: | | |
| npm run build | |
| npm run test | |
| npm run lint | |
| npm pack | |
| - name: Tagging | |
| run: | | |
| git add . | |
| git commit -m "$RELEASE_VERSION" | |
| git tag -a v$RELEASE_VERSION -m "$RELEASE_VERSION" | |
| - name: Push tag | |
| run: | | |
| git push | |
| git push origin --tags | |
| - run: | | |
| export GIT_TAG=$(git describe --tags --abbrev=0) | |
| echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV | |
| - name: Publish to Npmjs.com (Pre) | |
| run: npm publish --access=public --tag=next vscode-elements-elements-${{ env.RELEASE_VERSION }}.tgz | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} | |
| if: ${{ github.event.inputs.releaseChannel == 'pre' }} | |
| - name: Publish to Npmjs.com (Stable) | |
| run: npm publish --access=public vscode-elements-elements-${{ env.RELEASE_VERSION }}.tgz | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} | |
| if: ${{ github.event.inputs.releaseChannel == 'stable' }} | |
| - name: Github Release (Pre) | |
| uses: ncipollo/release-action@v1 | |
| if: ${{ github.event.inputs.releaseChannel == 'pre' }} | |
| with: | |
| artifacts: './vscode-elements-elements-*' | |
| prerelease: true | |
| draft: true | |
| tag: ${{ env.GIT_TAG }} | |
| generateReleaseNotes: true | |
| - name: Github Release (Stable) | |
| uses: ncipollo/release-action@v1 | |
| if: ${{ github.event.inputs.releaseChannel == 'stable' }} | |
| with: | |
| artifacts: './vscode-elements-elements-*' | |
| prerelease: false | |
| draft: true | |
| tag: ${{ env.GIT_TAG }} | |
| generateReleaseNotes: true |