Skip to content

Commit 6cacad4

Browse files
authored
test #GITBUILD
1 parent 735d448 commit 6cacad4

File tree

1 file changed

+25
-39
lines changed

1 file changed

+25
-39
lines changed

.github/workflows/main.yml

+25-39
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,62 @@
1-
# This is a basic workflow to help you get started with Actions
21
name: CI
32

4-
# Controls when the workflow will run
53
on:
6-
# Triggers the workflow on push or pull request events but only for the master branch
74
push:
85
branches: [ master ]
9-
10-
# Allows you to run this workflow manually from the Actions tab
116
workflow_dispatch:
127

13-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
148
jobs:
15-
# This workflow contains a single job called "build"
169
build:
17-
# The type of runner that the job will run on
1810
runs-on: windows-2019
1911

20-
# Steps represent a sequence of tasks that will be executed as part of the job
2112
steps:
22-
- name: Check Commit and Install 7Zip PowerShell Module
13+
- name: Check Commit Message
2314
shell: powershell
2415
run: |
25-
# cancel early, if not build commit
2616
$strVal ='${{ github.event.commits[0].message }}'
27-
# Convert commit message to a single line if multiline
2817
$singleLineStrVal = $strVal -replace "`r`n", " " -replace "`n", " "
29-
if($singleLineStrVal -match '#GITBUILD')
30-
{
31-
Write-Host 'True'
18+
if($singleLineStrVal -match '#GITBUILD') {
19+
Write-Host 'Build commit detected. Proceeding with build...'
20+
echo "build_trigger=true" >> $env:GITHUB_ENV
3221
} else {
33-
Write-Host 'False'
34-
exit(1)
35-
}
36-
Install-Module 7Zip4PowerShell -Force -Verbose
22+
Write-Host 'No build commit. Skipping build steps...'
23+
echo "build_trigger=false" >> $env:GITHUB_ENV
3724
3825
- uses: actions/checkout@v2
3926

40-
- name: Restore NuGet packages
41-
run: nuget restore UnityLauncherPro.sln
42-
43-
- name: Build Binary
44-
shell: cmd
45-
run: call .\Build.cmd
46-
47-
- name: Build Artifact
48-
shell: cmd
49-
run: call .\ArtifactBuild.cmd
27+
- name: Conditional Build Steps
28+
if: env.build_trigger == 'true'
29+
steps:
30+
- name: Install 7Zip PowerShell Module
31+
shell: powershell
32+
run: Install-Module 7Zip4PowerShell -Force -Verbose
33+
34+
- name: Restore NuGet packages
35+
run: nuget restore UnityLauncherPro.sln
36+
37+
- name: Build Binary
38+
shell: cmd
39+
run: call .\Build.cmd
40+
41+
- name: Build Artifact
42+
shell: cmd
43+
run: call .\ArtifactBuild.cmd
5044

5145
- name: Get current date and time
5246
id: datetime
5347
run: |
5448
echo "current_datetime=$(date +'%d/%m/%Y %H:%M')" >> $GITHUB_ENV
5549
56-
# Step to get previous tag and commits
5750
- name: Get commits since last release
5851
id: get_commits
5952
shell: bash
6053
run: |
61-
# Get the most recent tag
6254
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
6355
if [ "$PREV_TAG" = "none" ]; then
64-
echo "No previous tag found, listing all commits"
6556
COMMITS=$(git log --pretty=format:"* %s" --no-merges)
6657
else
67-
echo "Previous tag: $PREV_TAG"
68-
# List commits since last tag
6958
COMMITS=$(git log $PREV_TAG..HEAD --pretty=format:"* %s" --no-merges)
7059
fi
71-
echo "Commits since last release: $COMMITS"
72-
73-
# Save commits to environment file for later use
7460
echo "commits=$COMMITS" >> $GITHUB_ENV
7561
7662
- name: Create Release
@@ -87,8 +73,8 @@ jobs:
8773
### Commits in this release:
8874
${{ env.commits }}
8975
draft: false
90-
prerelease: false
91-
76+
prerelease: false
77+
9278
- name: Upload Release Asset
9379
id: upload-release-asset
9480
uses: actions/upload-release-asset@v1

0 commit comments

Comments
 (0)