Skip to content

WIP Auto Semver

WIP Auto Semver #11

Workflow file for this run

name: Build VSCode SysMon
on:
- push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
packages: write
attestations: write
id-token: write
steps:
# Prepare Job
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.7
# Create Release Semver
- name: Get the current branch name
id: get_branch
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Find related PR
id: find_pr
run: |
PR_URL=$(gh pr list --base ${{ env.branch }} --state=all --json url --limit=1 --jq '.[0].url')
echo "pr_url=$PR_URL" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch PR labels
id: get_labels
if: env.pr_url != ''
run: |
LABELS=$(gh pr view ${{ env.pr_url }} --json labels --jq '.labels | map(.name) | join(",")')
echo "labels=$LABELS" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set default version incrementer
run: echo "versionIncrementer=incrementPatch" >> $GITHUB_ENV
- name: Check for enhancement / breaking-change labels
if: env.labels != ''
run: |
LABELS="${{ env.labels }}"
if [[ $LABELS == *"enhancement"* ]]; then
echo "versionIncrementer=incrementMinor" >> $GITHUB_ENV
fi
if [[ $LABELS == *"breaking-change"* ]]; then
echo "versionIncrementer=incrementMajor" >> $GITHUB_ENV
fi
- name: Display Version Incrementer
run: echo "Version Incrementer == ${{ env.versionIncrementer }}"
- name: Create Release
if: |
github.ref == 'refs/heads/main' &&
github.repository == 'isontheline/vscode-sysmon'
run: gradle createRelease -Prelease.versionIncrementer=${{ env.versionIncrementer }}
# Set Project Version
- name: Set Frontend Version
run: npm version from-git --no-git-tag-version
# Build Project
- name: Build Project
run: |
npm install
npm run vscode:prepublish
npm run package
# Push Release
- name: Push Release
if: |
github.ref == 'refs/heads/main' &&
github.repository == 'isontheline/vscode-sysmon'
run: gradle pushRelease