Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 27 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,24 @@ on:
- 'v*'
workflow_dispatch:

permissions:
contents: write

jobs:
build:
name: Build and Package
name: Build
strategy:
matrix:
include:
- os: windows-latest
rid: win-x64
artifact_name: win-x64
binary_name: smoc.exe
ext: zip
- os: ubuntu-latest
rid: linux-x64
artifact_name: linux-x64
binary_name: smoc
ext: tar.gz
- os: macos-latest
rid: osx-arm64
artifact_name: mac-arm64
binary_name: smoc
ext: zip

runs-on: ${{ matrix.os }}

Expand All @@ -44,51 +41,51 @@ jobs:
run: |
dotnet publish smoc/smoc.csproj -c Release -r ${{ matrix.rid }} -p:PublishSingleFile=true -p:SelfContained=true --output ./publish

- name: Package
- name: Prepare Artifact
shell: bash
run: |
# Use tag name or 'manual' if triggered by dispatch
VERSION=${GITHUB_REF_NAME#v}
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION="manual"
fi

PACKAGE_NAME="smoc-v${VERSION}-${{ matrix.artifact_name }}-bin"
mkdir -p dist

# Include license and readme in the package
cp LICENSE ./publish/
cp README.md ./publish/

if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
powershell -Command "Compress-Archive -Path 'publish\*' -DestinationPath 'dist/${PACKAGE_NAME}.zip'"
elif [[ "${{ matrix.ext }}" == "zip" ]]; then
cd publish && zip -r ../dist/${PACKAGE_NAME}.zip .
else
cd publish && tar -czvf ../dist/${PACKAGE_NAME}.tar.gz .
fi

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: dist/*
path: ./publish/*

release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
merge-multiple: true

- name: Package for Release
run: |
# Use tag name or 'manual' if triggered by dispatch
VERSION=${GITHUB_REF_NAME#v}
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION="manual"
fi
mkdir dist

# Package Linux (tar.gz)
cd artifacts/linux-x64 && tar -czvf ../../dist/smoc-v${VERSION}-linux-x64-bin.tar.gz . && cd ../..

# Package Windows (zip)
cd artifacts/win-x64 && zip -r ../../dist/smoc-v${VERSION}-win-x64-bin.zip . && cd ../..

# Package MacOS (zip)
cd artifacts/mac-arm64 && zip -r ../../dist/smoc-v${VERSION}-mac-arm64-bin.zip . && cd ../..

- name: Create Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: ./artifacts/*
files: dist/*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading