-
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (67 loc) · 2.31 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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 == 'dragon-okinawa/dragon'
run: gradle createRelease -Prelease.versionIncrementer=${{ env.versionIncrementer }}
# Set Project Version
- name: Set Frontend Version
run: npm version from-git --no-git-tag-version