chore: Update timeout minutes for label check workflow #19
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: Build and Deploy | |
on: | |
- push | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
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 Tag 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 Tag | |
if: | | |
github.ref == 'refs/heads/main' && | |
github.repository == 'isontheline/vscode-sysmon' | |
run: gradle createRelease -Prelease.versionIncrementer=${{ env.versionIncrementer }} | |
# Set Project Version | |
- name: Set Project 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 | |
# Publish to Visual Studio Marketplace | |
- name: Publish to Visual Studio Marketplace | |
if: | | |
github.ref == 'refs/heads/main' && | |
github.repository == 'isontheline/vscode-sysmon' | |
uses: HaaLeo/publish-vscode-extension@v1 | |
id: publishToMarketplace | |
with: | |
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} | |
registryUrl: https://marketplace.visualstudio.com | |
# Publish to Open VSX Registry | |
- name: Publish to Open VSX Registry | |
if: | | |
github.ref == 'refs/heads/main' && | |
github.repository == 'isontheline/vscode-sysmon' | |
uses: HaaLeo/publish-vscode-extension@v1 | |
with: | |
extensionFile: ${{ steps.publishToMarketplace.outputs.vsixPath }} | |
pat: ${{ secrets.OPEN_VSX_TOKEN }} | |
# Push Tag | |
- name: Push Tag | |
if: | | |
github.ref == 'refs/heads/main' && | |
github.repository == 'isontheline/vscode-sysmon' | |
run: gradle pushRelease | |
# Create Release | |
- name: Create release | |
if: | | |
github.ref == 'refs/heads/main' && | |
github.repository == 'isontheline/vscode-sysmon' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
tag=$(git describe --tags --abbrev=0) | |
gh release create "$tag" \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="v${tag#v}" \ | |
--generate-notes | |