Skip to content

Commit

Permalink
Implemented automatic build & release pipeline using GitHub Actions (#49
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kokolihapihvi authored Oct 7, 2023
1 parent 07824fe commit 45ee01c
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 2 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
id: build
run: |
VERSION=$(sed -nr 's/^.*const string version.*"(.*)".*$/\1/pi' ./RockSniffer/Program.cs)
echo "Sniffer version: $VERSION"
echo "SNIFFER_VERSION=$VERSION" >> "$GITHUB_OUTPUT"
dotnet build --configuration Release --no-restore
- name: Publish
env:
SNIFFER_VERSION: ${{ steps.build.outputs.SNIFFER_VERSION }}
run: |
dotnet publish RockSniffer -c Release -o ./publish --runtime win-x64 --framework=net6.0-windows --self-contained false -p:PublishSingleFile=true
cp -r ./addons ./publish/addons
(cd ./publish && zip -r "$OLDPWD/RockSniffer $SNIFFER_VERSION.zip" .)
echo "$SNIFFER_VERSION" > VERSION
- uses: actions/upload-artifact@v3
with:
name: RockSniffer-release
path: |
VERSION
./RockSniffer ${{ steps.build.outputs.SNIFFER_VERSION }}.zip
release:
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: write
steps:
- uses: actions/download-artifact@v3
with:
name: RockSniffer-release
- name: Get version
id: get-version
run: |
echo "SNIFFER_VERSION=$(cat VERSION)" >> "$GITHUB_OUTPUT"
- uses: ncipollo/release-action@v1
with:
name: v${{ steps.get-version.outputs.SNIFFER_VERSION }}
tag: v${{ steps.get-version.outputs.SNIFFER_VERSION }}
allowUpdates: true
updateOnlyUnreleased: true
commit: ${{ github.sha }}
prerelease: true
draft: true
generateReleaseNotes: true
artifacts: "*.zip"
3 changes: 3 additions & 0 deletions RockSniffer/RockSniffer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<PropertyGroup>
<ApplicationIcon>sniffy.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>none</DebugType>
</PropertyGroup>
<ItemGroup>
<Content Include="sniffy.ico" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion RockSnifferLib
2 changes: 1 addition & 1 deletion Rocksmith2014PsarcLib

0 comments on commit 45ee01c

Please sign in to comment.