Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidVeksler authored Aug 14, 2024
1 parent 4a5a51c commit b8068e8
Showing 1 changed file with 51 additions and 15 deletions.
66 changes: 51 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ on:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
Expand All @@ -25,43 +28,76 @@ jobs:
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Publish
run: dotnet publish --configuration Release --output ./publish
run: dotnet publish --configuration Release --output ./publish --runtime ${{ matrix.os == 'ubuntu-latest' && 'linux-x64' || matrix.os == 'windows-latest' && 'win-x64' || 'osx-x64' }} --self-contained true
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: dist
name: dist-${{ matrix.os }}
path: publish

create_release:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release ${{ github.run_number }}
body: |
Automated release for commit ${{ github.sha }}
draft: false
prerelease: false
- name: Zip Release
run: zip -r release.zip dist
- name: Upload Release Asset
- name: Download Linux artifact
uses: actions/download-artifact@v3
with:
name: dist-ubuntu-latest
path: dist-linux
- name: Download Windows artifact
uses: actions/download-artifact@v3
with:
name: dist-windows-latest
path: dist-windows
- name: Download macOS artifact
uses: actions/download-artifact@v3
with:
name: dist-macos-latest
path: dist-macos
- name: Zip Releases
run: |
zip -r release-linux.zip dist-linux
zip -r release-windows.zip dist-windows
zip -r release-macos.zip dist-macos
- name: Upload Linux Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-linux.zip
asset_name: release-linux.zip
asset_content_type: application/zip
- name: Upload Windows Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-windows.zip
asset_name: release-windows.zip
asset_content_type: application/zip
- name: Upload macOS Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release.zip
asset_name: release.zip
asset_path: ./release-macos.zip
asset_name: release-macos.zip
asset_content_type: application/zip

0 comments on commit b8068e8

Please sign in to comment.