Rover Runner CI #6
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
# This is a basic workflow to help you get started with Actions | |
name: Rover Runner CI | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseType: | |
description: "Release Type" | |
required: true | |
type: choice | |
default: "patch" | |
options: | |
- patch | |
- minor | |
- major | |
publishMarketplace: | |
description: "Publish on Visual Studio Marketplace?" | |
required: true | |
type: choice | |
default: "yes" | |
options: | |
- "yes" | |
- "no" | |
jobs: | |
release: | |
runs-on: macos-latest | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.BOT_ACCESS_TOKEN }} | |
- name: Setup Node version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build Package | |
run: npm run prepublish-ci | |
- name: Run Tests | |
uses: coactions/setup-xvfb@v1 | |
with: | |
run: npm run test | |
- name: Create Changelog | |
run: | | |
git log $(git describe --tags --abbrev=0)..HEAD --oneline &> ${{ github.workspace }}-CHANGELOG.txt | |
cat ${{ github.workspace }}-CHANGELOG.txt | |
- name: Setup Git | |
run: | | |
git config --global user.name "SDL-Service-Account" | |
git config --global user.email "[email protected]" | |
- name: Get Current Version Number | |
run: | | |
CURRENT_VERSION=$(cat package.json | jq .version | cut -d'"' -f 2) | |
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV | |
- name: Compile New Version | |
run: | | |
RELEASE_VERSION=$(npx semver $CURRENT_VERSION -i github.event.inputs.releaseType) | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
echo "Bump to $RELEASE_VERSION" | |
- name: Version Package | |
run: | | |
npm version $RELEASE_VERSION | |
git tag -a $RELEASE_VERSION -m "$RELEASE_VERSION" | |
- name: Package Extension | |
run: npm run package -- $RELEASE_VERSION -o "./rover-runner-$RELEASE_VERSION.vsix" | |
- name: Publish to Visual Studio Marketplace | |
run: npm run publish -- --packagePath "./rover-runner-$RELEASE_VERSION.vsix" -p ${{ secrets.VSC_MKTP_PAT }} | |
if: ${{ github.event.inputs.publishMarketplace == 'yes' }} | |
- name: Push Tags | |
run: | | |
git log -1 --stat | |
git push origin main --tags | |
- run: | | |
export GIT_TAG=$(git describe --tags --abbrev=0) | |
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV | |
- name: GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "./rover-runner-*" | |
bodyFile: ${{ github.workspace }}-CHANGELOG.txt | |
tag: ${{ env.GIT_TAG }} |