v0.0.10 #16
Workflow file for this run
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
# Create new tag | |
# git tag v0.0.1 | |
# git push --tags | |
name: Release on publish | |
on: | |
release: | |
types: [published] | |
env: | |
DOTNET_VERSION: '7.0.x' | |
jobs: | |
release: | |
name: Release | |
strategy: | |
matrix: | |
kind: ['linux', 'windows'] | |
include: | |
- kind: linux | |
os: ubuntu-latest | |
target: linux-x64 | |
- kind: windows | |
os: windows-latest | |
target: win-x64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Build | |
shell: bash | |
run: | | |
tag=$(git describe --tags --abbrev=0) | |
release_name="lifelogbb-$tag-${{ matrix.target }}" | |
# Build everything | |
dotnet publish --framework net7.0 --runtime "${{ matrix.target }}" -c Release --property:PublishDir="$release_name" | |
dotnet tool install --global dotnet-ef | |
# Build migration bundle https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/applying?tabs=dotnet-core-cli | |
if [ "${{ matrix.target }}" == "win-x64" ]; then | |
dotnet ef migrations bundle -r "${{ matrix.target }}" -p LifelogBb -o "./LifelogBb/$release_name/efbundle.exe" | |
else | |
dotnet ef migrations bundle --self-contained -r "${{ matrix.target }}" -p LifelogBb -o "./LifelogBb/$release_name/efbundle" | |
fi | |
# Pack files | |
if [ "${{ matrix.target }}" == "win-x64" ]; then | |
7z a -tzip "$release_name.zip" "./LifelogBb/$release_name/*" | |
else | |
tar czvf "$release_name.tar.gz" -C "./LifelogBb/$release_name" . | |
fi | |
# Delete output directory | |
rm -r "./LifelogBb/$release_name" | |
- name: Publish | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: "lifelogbb*" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Reference: https://www.newline.co/@krishna/release-management-with-aspnet-core-and-github-actions--ff31a146 |