-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* ci: add github actions ci * ci: upload build artifacts * ci: fix wrong branch name * ci: add artifact names * ci: refactor for easier portability * ci: simplify step * ci: automatically add build result to release * ci: use windows-2019 * fix: twinx and tiki are switched around #11 * ci: fix space in artifact name * ci: update update.xml on release * ci: refactor a bit and actually update & commit * ci: put path to FunkeySelector.exe * ci: attempt to debug * ci: try to push changes * ci: checkout default branch * ci: push to default branch * chore(update): update update.xml * ci: debug null error * chore(update): update update.xml * ci: set correct asset name * ci: use GITHUB_OUTPUT properly * chore(update): update update.xml * revert: "chore(update): update update.xml" This reverts commit 42888e6. * ci: set version in AssemblyInfo.cs * chore(update): update update.xml * chore(update): update update.xml * ci: get tag name properly * ci: run on every push & PR * ci: use action to get tag name * ci: run always on push * ci: fetch git tags * ci: unshallow using git fetch * ci: try using other action to get tag * ci: commit changes to AssemblyInfo.cs * ci: clarify commit message * ci: correct description * ci: get version from update.xml * ci: don't care about tags * chore(release): v3.0.7 * ci: add warning about unintended behavior * revert: changes from test releases --------- Co-authored-by: Github Actions Bot <>
- Loading branch information
Showing
3 changed files
with
168 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Builds a .NET framework project | ||
name: Nightly builds | ||
|
||
env: | ||
projectName: FunkeySelectorGUI | ||
projectFolder: FunkeySelector | ||
solutionFile: FunkeySelector.sln | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
push: | ||
branches-ignore: | ||
- "gh-pages" | ||
|
||
pull_request: | ||
branches-ignore: | ||
- "gh-pages" | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
configuration: [ Debug, Release ] | ||
runs-on: windows-2019 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup MSBuild | ||
uses: microsoft/setup-msbuild@v1 | ||
|
||
- name: Setup NuGet | ||
uses: NuGet/setup-nuget@v1 | ||
|
||
- name: Restore Packages | ||
run: nuget restore ${{ env.solutionFile }} | ||
|
||
- name: Get version from update.xml | ||
id: getVersion | ||
uses: mavrosxristoforos/get-xml-info@1.2.1 | ||
with: | ||
xml-file: update.xml | ||
xpath: //update/@version | ||
|
||
- name: Normalize the version string into SemVer format (x.x.x) | ||
id: normalizeVersion | ||
run: | | ||
$versionString = "${{ steps.getVersion.outputs.info }}" | ||
$digits = $versionString.Split(".").Length | ||
if ($digits -eq 1) { $versionString += ".0.0" } | ||
elseif ($digits -eq 2) { $versionString += ".0" } | ||
"VERSION=$($versionString)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | ||
- name: Set version in AssemblyInfo.cs | ||
uses: secondbounce/assemblyinfo-update@v2 | ||
with: | ||
version: "${{ steps.normalizeVersion.outputs.VERSION }}" | ||
|
||
- name: Build solution | ||
run: msbuild ${{ env.solutionFile }} -t:rebuild -property:Configuration=${{ matrix.configuration }} | ||
|
||
- name: Upload the build results as an artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: ${{ env.projectFolder }}/bin/${{ matrix.configuration }}/* | ||
name: ${{ env.projectName }}.Nightly.${{ matrix.configuration }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Builds a .NET framework project in Release mode when a new release is created | ||
# and uploads the build results to the newly created release | ||
# then updates update.xml and Properties/AssemblyInfo.cs | ||
name: Publish release | ||
|
||
env: | ||
projectName: FunkeySelectorGUI | ||
projectFolder: FunkeySelector | ||
solutionFile: FunkeySelector.sln | ||
|
||
on: | ||
release: | ||
types: | ||
- released | ||
|
||
jobs: | ||
publish: | ||
permissions: | ||
contents: write | ||
id-token: write | ||
strategy: | ||
matrix: # please please please don't put multiple build configurations in here, it will cause unintended behaviour | ||
configuration: [ Release ] | ||
runs-on: windows-2019 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: "${{ github.event.repository.default_branch }}" | ||
|
||
- name: Setup git configuration | ||
run: | | ||
git config user.name "Github Actions Bot" | ||
git config user.email "<>" | ||
- name: Setup MSBuild | ||
uses: microsoft/setup-msbuild@v1 | ||
|
||
- name: Setup NuGet | ||
uses: NuGet/setup-nuget@v1 | ||
|
||
- name: Restore Packages | ||
run: nuget restore ${{ env.solutionFile }} | ||
|
||
- name: Get version from release name | ||
id: version | ||
uses: mad9000/actions-find-and-replace-string@4 | ||
with: | ||
source: "${{ github.event.release.tag_name }}" | ||
find: "v" | ||
replace: "" | ||
|
||
- name: Normalize the version string into SemVer format (x.x.x) | ||
id: normalizeVersion | ||
run: | | ||
$versionString = "${{ steps.version.outputs.value }}" | ||
$digits = $versionString.Split(".").Length | ||
if ($digits -eq 1) { $versionString += ".0.0" } | ||
elseif ($digits -eq 2) { $versionString += ".0" } | ||
"VERSION=$($versionString)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | ||
- name: Set version in AssemblyInfo.cs | ||
uses: secondbounce/assemblyinfo-update@v2 | ||
with: | ||
version: "${{ steps.normalizeVersion.outputs.VERSION }}" | ||
|
||
- name: Build solution | ||
run: msbuild ${{ env.solutionFile }} -t:rebuild -property:Configuration=${{ matrix.configuration }} | ||
|
||
- name: Upload the build results as an artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: ${{ env.projectFolder }}/bin/${{ matrix.configuration }}/* | ||
name: ${{ env.projectName }}.${{ github.event.release.tag_name }}.${{ matrix.configuration }} | ||
|
||
- name: Upload build results to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
file: ${{ env.projectFolder }}/bin/${{ matrix.configuration }}/FunkeySelector.exe | ||
asset_name: FunkeySelectorGUI.exe | ||
|
||
- name: Get file size of FunkeySelectorGUI.exe | ||
id: filesize | ||
run: | | ||
"FILESIZE=$((Get-Item ${{ env.projectFolder }}/bin/${{ matrix.configuration }}/FunkeySelector.exe).length)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | ||
- name: Update update.xml | ||
run: echo '<update version="${{ steps.version.outputs.value }}" name="${{ github.event.release.name }}" size="${{ steps.filesize.outputs.FILESIZE }}" url="https://github.com/GittyMac/FunkeySelectorGUI/releases/download/${{ github.event.release.tag_name }}/FunkeySelectorGUI.exe" />' > update.xml | ||
|
||
- name: Push the changes made to update.xml | ||
run: | | ||
git add update.xml | ||
git add ${{ env.projectFolder }}/Properties/AssemblyInfo.cs | ||
git commit -m "chore(release): ${{ github.event.release.tag_name }}" | ||
git push origin ${{ github.event.repository.default_branch }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.