Skip to content

Commit

Permalink
Workflow to publish GitHub release (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-smith authored Oct 22, 2021
1 parent fc37763 commit 79eb4e0
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: CI
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
workflow_dispatch:
Expand Down Expand Up @@ -35,3 +37,26 @@ jobs:
run: dotnet test src/OctoshiftCLI.sln --filter FullyQualifiedName\~Integration --no-build --verbosity normal
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

publish:

runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: build

steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Build Artifacts
run: ./publish.ps1
shell: pwsh
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
./dist/octoshift.win-x64.zip
./dist/octoshift.linux-x64.tar.gz
./dist/octoshift.osx-x64.tar.gz
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,5 @@ MigrationBackup/

# VS (full) launchSettings, this might have PATs in the env vars section
/src/OctoshiftCLI/Properties/launchSettings.json

/dist
21 changes: 21 additions & 0 deletions publish.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
dotnet publish src/OctoshiftCLI/OctoshiftCLI.csproj -c Release -o dist/win-x64/ -r win-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true /p:DebugType=None /p:IncludeNativeLibrariesForSelfExtract=true

if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}

dotnet publish src/OctoshiftCLI/OctoshiftCLI.csproj -c Release -o dist/linux-x64/ -r linux-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true /p:DebugType=None /p:IncludeNativeLibrariesForSelfExtract=true

if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}

dotnet publish src/OctoshiftCLI/OctoshiftCLI.csproj -c Release -o dist/osx-x64/ -r osx-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true /p:DebugType=None /p:IncludeNativeLibrariesForSelfExtract=true

if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}

Compress-Archive -Path ./dist/win-x64/octoshift.exe -DestinationPath ./dist/octoshift.win-x64.zip -Force
tar -cvzf ./dist/octoshift.linux-x64.tar.gz -C ./dist/linux-x64 octoshift
tar -cvzf ./dist/octoshift.osx-x64.tar.gz -C ./dist/osx-x64 octoshift

0 comments on commit 79eb4e0

Please sign in to comment.