Skip to content

Commit

Permalink
Github actions, build and publish
Browse files Browse the repository at this point in the history
  • Loading branch information
stulda committed May 31, 2024
1 parent cd48b29 commit 0551da6
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
File renamed without changes.
58 changes: 58 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish

on:
release:
types: [published]

jobs:
release:
name: Release
strategy:
matrix:
kind: ['linux', 'windows', 'macOS']
include:
- kind: linux
os: ubuntu-latest
target: linux-x64
- kind: windows
os: windows-latest
target: win-x64
- kind: macOS
os: macos-latest
target: osx-x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x

- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
release_name="wcc-$tag-${{ matrix.target }}"
# Build everything
dotnet publish --runtime "${{ matrix.target }}" -c Release -o "$release_name"
# Pack files
if [ "${{ matrix.target }}" == "win-x64" ]; then
# Pack to zip for Windows
7z a -tzip "${release_name}.zip" "./${release_name}/*"
else
tar czvf "${release_name}.tar.gz" "$release_name"
fi
# Delete output directory
rm -r "$release_name"
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "wcc*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 0551da6

Please sign in to comment.