Skip to content

test #GITBUILD

test #GITBUILD #62

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: windows-2019
steps:
- name: Check Commit Message
shell: powershell
run: |
$strVal ='${{ github.event.commits[0].message }}'
$singleLineStrVal = $strVal -replace "`r`n", " " -replace "`n", " "
if($singleLineStrVal -match '#GITBUILD') {
Write-Host 'Build commit detected. Proceeding with build...'
echo "build_trigger=true" >> $env:GITHUB_ENV
} else {
Write-Host 'No build commit. Skipping build steps...'
echo "build_trigger=false" >> $env:GITHUB_ENV
- uses: actions/checkout@v2
- name: Conditional Build Steps
if: env.build_trigger == 'true'
steps:
- name: Install 7Zip PowerShell Module
shell: powershell
run: Install-Module 7Zip4PowerShell -Force -Verbose
- name: Restore NuGet packages
run: nuget restore UnityLauncherPro.sln
- name: Build Binary
shell: cmd
run: call .\Build.cmd
- name: Build Artifact
shell: cmd
run: call .\ArtifactBuild.cmd
- name: Get current date and time
id: datetime
run: |
echo "current_datetime=$(date +'%d/%m/%Y %H:%M')" >> $GITHUB_ENV
- name: Get commits since last release
id: get_commits
shell: bash
run: |
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
if [ "$PREV_TAG" = "none" ]; then
COMMITS=$(git log --pretty=format:"* %s" --no-merges)
else
COMMITS=$(git log $PREV_TAG..HEAD --pretty=format:"* %s" --no-merges)
fi
echo "commits=$COMMITS" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{github.run_number}}
release_name: ${{ env.current_datetime }} (${{ github.run_number }})
body: |
Automated Release by GitHub Action CI
### Commits in this release:
${{ env.commits }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./UnityLauncherPro.zip
asset_name: UnityLauncherPro.zip
asset_content_type: application/zip