Skip to content

Commit

Permalink
Update workflow to create a self-extracting exe
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik White committed Mar 26, 2022
1 parent de4ebaf commit 027c728
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ jobs:
targetplatform: [x86, x64]

env:
RELEASE_PATH: ./bin/release
OUTPUT_PATH: ./bin/release/${{ matrix.targetplatform }}
INSTALLER_NAME: ${GITHUB_REPOSITORY#*/}-${{ github.event.release.tag_name }}-${{ matrix.targetplatform }}.exe
TARGET_PROJECT: ${GITHUB_REPOSITORY#*/}.GUI

steps:
- name: Clone repo
Expand All @@ -25,14 +27,19 @@ jobs:
dotnet-version: '6.0.x'

- name: Build release
run: dotnet publish Mosey.GUI/Mosey.GUI.csproj --configuration Release --output ${{ env.RELEASE_PATH }}/${{ matrix.targetplatform }} --runtime win-${{ matrix.targetplatform }} -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishReadyToRun=true -p:PublishSingleFile=true --self-contained true
run: |
dotnet publish ${{ env.TARGET_PROJECT }}/${{ env.TARGET_PROJECT }}.csproj --configuration Release --output ${{ env.OUTPUT_PATH }} --runtime win-${{ matrix.targetplatform }} -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishReadyToRun=true -p:PublishSingleFile=true --self-contained true
Rename-Item -Path ${{ env.OUTPUT_PATH }}/${{ env.TARGET_PROJECT }}.exe -NewName ${GITHUB_REPOSITORY#*/}.exe
- name: Build installer
run: 7z a -sfx ${{ env.OUTPUT_PATH }}/${{ env.INSTALLER_NAME }} ${{ env.OUTPUT_PATH }}/*.exe ${{ env.OUTPUT_PATH }}/*.json

- name: Upload release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.RELEASE_PATH }}/${{ matrix.targetplatform }}/Mosey.exe
asset_name: Mosey-${{ github.event.release.tag_name }}-${{ matrix.targetplatform }}.exe
asset_path: ${{ env.OUTPUT_PATH }}/${{ env.INSTALLER_NAME }}
asset_name: ${{ env.INSTALLER_NAME }}
asset_content_type: binary/octet-stream

0 comments on commit 027c728

Please sign in to comment.