Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile, upload and release DLLs #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build

env:
Branch: ${{github.ref_name}}
Solution: ${{github.event.repository.name}}.sln # .
Platform: #Any CPU|Win32|x64
Configuration: Release
Artifacts: bin/Release
Executable: ${{github.event.repository.name}}.exe # *

on:
push:
Branches: $Branch
pull_request:
Branches: $Branch
workflow_dispatch:

permissions:
contents: write

jobs:
Windows:
runs-on: windows-2019
steps:

- name: Clone repo and submodules
run: git clone --recurse-submodules https://github.com/${{github.repository}}.git . #--branch ${{env.Branch}}

- name: Get current date, commit hash and count
run: |
echo "CommitDate=$(git show -s --date=format:'%Y-%m-%d' --format=%cd)" >> $env:GITHUB_ENV
echo "CommitHashShort=$(git rev-parse --short=7 HEAD)" >> $env:GITHUB_ENV
echo "CommitCount=$(git rev-list --count ${{env.Branch}})" >> $env:GITHUB_ENV

- name: Add MSBuild to PATH
uses: microsoft/[email protected]

- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.Solution}}

- name: Build
run: |
msbuild /m ${{env.Solution}} #/p:Configuration="${{env.Configuration}}" /p:Platform="${{env.Platform}}"

- name: Upload Installer Artifact to GitHub
uses: actions/upload-artifact@v4
with:
name: "${{github.event.repository.name}}_r${{env.CommitCount}}@${{env.CommitHashShort}}"
path: "${{github.workspace}}/${{env.Artifacts}}/"

- name: Compress artifacts
uses: vimtor/[email protected]
with:
files: '${{env.Artifacts}}/'
dest: "build/${{github.event.repository.name}}_r${{env.CommitCount}}@${{env.CommitHashShort}}.zip"

- name: GitHub pre-release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{secrets.GITHUB_TOKEN}}"
automatic_release_tag: "latest"
prerelease: false
title: "[${{env.CommitDate}}] ${{github.event.repository.name}} r${{env.CommitCount}}@${{env.CommitHashShort}}"
files: "build/${{github.event.repository.name}}_r${{env.CommitCount}}@${{env.CommitHashShort}}.zip"