Release #18
This file contains 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: | |
required: true | |
default: 'minor' | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- name: Install deps | |
run: npm ci | |
- name: Run Tests | |
run: xvfb-run -a npm test | |
if: runner.os == 'Linux' | |
- name: Run Tests | |
run: npm test | |
if: runner.os != 'Linux' | |
- name: Package | |
if: success() && matrix.os == 'ubuntu-latest' | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
npm run package ${RELEASE_TYPE} | |
echo "packageFile=$(ls *.vsix)" >> $GITHUB_ENV | |
echo "version=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV | |
env: | |
RELEASE_TYPE: ${{ inputs.releaseType }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish | |
if: success() && matrix.os == 'ubuntu-latest' | |
run: | | |
npm run publish -- -i ${VSIX_PATH} | |
env: | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
VSIX_PATH: ${{ env.packageFile }} | |
- name: Push tag and back merge | |
if: success() && matrix.os == 'ubuntu-latest' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAG_VERSION: ${{ env.version }} | |
run: | | |
git merge $TAG_VERSION | |
git push --tags | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
uses: softprops/action-gh-release@v2 | |
if: success() && matrix.os == 'ubuntu-latest' | |
with: | |
files: | | |
${{ env.packageFile }} | |
tag_name: ${{ env.version }} |