Merge pull request #23 from ubisoft/misc-fixes #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
build_and_test: | |
name: Build & Test | |
runs-on: 'windows-latest' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 6.0.x | |
- name: Run tests | |
run: dotnet test --configuration Release | |
release: | |
name: Release | |
needs: [ build_and_test ] | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
strategy: | |
matrix: | |
kind: ['windows'] | |
include: | |
- kind: windows | |
os: windows-latest | |
target: win-x64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 6.0.x | |
- name: Build | |
shell: bash | |
run: | | |
tag=$(git describe --tags --abbrev=0) | |
release_name="GitTimelapseView-$tag-${{ matrix.target }}" | |
# Build everything | |
dotnet publish GitTimelapseView/GitTimelapseView.csproj --framework net6.0-windows --runtime "${{ matrix.target }}" -c Release -o "$release_name" --self-contained | |
# 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: "GitTimelapseView-*" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |