Skip to content

Commit eed9d9a

Browse files
authored
test #GITBUILD
1 parent 6cacad4 commit eed9d9a

File tree

1 file changed

+43
-14
lines changed

1 file changed

+43
-14
lines changed

Diff for: .github/workflows/main.yml

+43-14
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,92 @@
11
name: CI
22

33
on:
4+
# Triggers the workflow on push or pull request events but only for the master branch
45
push:
56
branches: [ master ]
7+
8+
# Allows you to run this workflow manually from the Actions tab
69
workflow_dispatch:
710

811
jobs:
12+
# This workflow contains a single job called "build"
913
build:
14+
# The type of runner that the job will run on
1015
runs-on: windows-2019
1116

17+
# Steps represent a sequence of tasks that will be executed as part of the job
1218
steps:
19+
# Step to check if the commit message contains #GITBUILD
1320
- name: Check Commit Message
1421
shell: powershell
1522
run: |
16-
$strVal ='${{ github.event.commits[0].message }}'
23+
# Get the commit message
24+
$strVal = '${{ github.event.commits[0].message }}'
25+
# Convert commit message to a single line if multiline
1726
$singleLineStrVal = $strVal -replace "`r`n", " " -replace "`n", " "
18-
if($singleLineStrVal -match '#GITBUILD') {
27+
if ($singleLineStrVal -match '#GITBUILD') {
1928
Write-Host 'Build commit detected. Proceeding with build...'
2029
echo "build_trigger=true" >> $env:GITHUB_ENV
2130
} else {
2231
Write-Host 'No build commit. Skipping build steps...'
2332
echo "build_trigger=false" >> $env:GITHUB_ENV
2433
34+
# Step to ensure the repository is checked out
2535
- uses: actions/checkout@v2
2636

37+
# Conditional steps for building the project
2738
- name: Conditional Build Steps
2839
if: env.build_trigger == 'true'
29-
steps:
30-
- name: Install 7Zip PowerShell Module
31-
shell: powershell
32-
run: Install-Module 7Zip4PowerShell -Force -Verbose
40+
run: echo "Build steps will proceed because commit contains #GITBUILD."
3341

34-
- name: Restore NuGet packages
35-
run: nuget restore UnityLauncherPro.sln
42+
# Install 7Zip PowerShell module
43+
- name: Install 7Zip PowerShell Module
44+
if: env.build_trigger == 'true'
45+
shell: powershell
46+
run: Install-Module 7Zip4PowerShell -Force -Verbose
3647

37-
- name: Build Binary
38-
shell: cmd
39-
run: call .\Build.cmd
48+
# Restore NuGet packages
49+
- name: Restore NuGet packages
50+
if: env.build_trigger == 'true'
51+
run: nuget restore UnityLauncherPro.sln
4052

41-
- name: Build Artifact
42-
shell: cmd
43-
run: call .\ArtifactBuild.cmd
53+
# Build the binary
54+
- name: Build Binary
55+
if: env.build_trigger == 'true'
56+
shell: cmd
57+
run: call .\Build.cmd
58+
59+
# Build the artifact
60+
- name: Build Artifact
61+
if: env.build_trigger == 'true'
62+
shell: cmd
63+
run: call .\ArtifactBuild.cmd
4464

65+
# Get the current date and time
4566
- name: Get current date and time
4667
id: datetime
4768
run: |
69+
# Save the current date and time to an environment variable
4870
echo "current_datetime=$(date +'%d/%m/%Y %H:%M')" >> $GITHUB_ENV
4971
72+
# Step to get previous tag and commits
5073
- name: Get commits since last release
5174
id: get_commits
5275
shell: bash
5376
run: |
77+
# Get the most recent tag
5478
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
5579
if [ "$PREV_TAG" = "none" ]; then
80+
echo "No previous tag found, listing all commits"
5681
COMMITS=$(git log --pretty=format:"* %s" --no-merges)
5782
else
83+
echo "Previous tag: $PREV_TAG"
84+
# List commits since last tag
5885
COMMITS=$(git log $PREV_TAG..HEAD --pretty=format:"* %s" --no-merges)
5986
fi
6087
echo "commits=$COMMITS" >> $GITHUB_ENV
6188
89+
# Create a release
6290
- name: Create Release
6391
id: create_release
6492
uses: actions/create-release@latest
@@ -75,6 +103,7 @@ jobs:
75103
draft: false
76104
prerelease: false
77105

106+
# Upload the release asset
78107
- name: Upload Release Asset
79108
id: upload-release-asset
80109
uses: actions/upload-release-asset@v1

0 commit comments

Comments
 (0)