Skip to content

5.2

5.2 #57

Workflow file for this run

name: master
on:
push:
branches: [ master ]
jobs:
build_test_windows:
name: Run build and test [Windows]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8'
- name: Run test
run: |
dotnet test test/
build_test_mac:
name: Run build and test [macOS]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8'
- name: Run test
run: |
dotnet test test/
build_test_linux:
name: Run build and test [Linux]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8'
- name: Run test
run: |
dotnet test test/
publish_nuget:
name: Publish NuGet package
runs-on: ubuntu-latest
needs: [build_test_mac, build_test_linux, build_test_windows]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get install -y zip unzip tar
- name: Setup environment variables
run: |
APP_VERSION=`cat VERSION`
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8'
- name: publish-nuget
shell: pwsh
run: |
$env:NugetApiKey = "${{ secrets.NUGET_API_KEY }}"
ls
./pack.ps1 ${{ env.APP_VERSION }}
publish_release:
name: Publish release
runs-on: ubuntu-latest
needs: [build_test_mac, build_test_linux, build_test_windows]
permissions:
packages: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get install -y zip unzip tar
- name: Setup environment variables
run: |
APP_VERSION=`cat VERSION`
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
APP_VERSION_ARR=(${APP_VERSION//./ })
echo "APP_VERSION_LINK=${APP_VERSION_ARR[0]}${APP_VERSION_ARR[1]}" >> $GITHUB_ENV
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8'
- name: Publish Binaries
run: |
mkdir -p __ga
dotnet publish ./src/Tur.csproj -f net8.0 /p:AssemblyVersion=${{ env.APP_VERSION }} /p:DebugType=None --self-contained true -v normal -p:PublishTrimmed=true -p:PublishSingleFile=true -r linux-x64 -c Release -o __ga/linux-x64
dotnet publish ./src/Tur.csproj -f net8.0 /p:AssemblyVersion=${{ env.APP_VERSION }} /p:DebugType=None --self-contained true -v normal -p:PublishTrimmed=true -p:PublishSingleFile=true -r linux-musl-x64 -c Release -o __ga/linux-musl-x64
dotnet publish ./src/Tur.csproj -f net8.0 /p:AssemblyVersion=${{ env.APP_VERSION }} /p:DebugType=None --self-contained true -v normal -p:PublishTrimmed=true -p:PublishSingleFile=true -r linux-arm -c Release -o __ga/linux-arm
dotnet publish ./src/Tur.csproj -f net8.0 /p:AssemblyVersion=${{ env.APP_VERSION }} /p:DebugType=None --self-contained true -v normal -p:PublishTrimmed=true -p:PublishSingleFile=true -r linux-arm64 -c Release -o __ga/linux-arm64
dotnet publish ./src/Tur.csproj -f net8.0 /p:AssemblyVersion=${{ env.APP_VERSION }} /p:DebugType=None --self-contained true -v normal -p:PublishTrimmed=true -p:PublishSingleFile=true -r win-x64 -c Release -o __ga/win-x64
dotnet publish ./src/Tur.csproj -f net8.0 /p:AssemblyVersion=${{ env.APP_VERSION }} /p:DebugType=None --self-contained true -v normal -p:PublishTrimmed=true -p:PublishSingleFile=true -r win-x86 -c Release -o __ga/win-x86
dotnet publish ./src/Tur.csproj -f net8.0 /p:AssemblyVersion=${{ env.APP_VERSION }} /p:DebugType=None --self-contained true -v normal -p:PublishTrimmed=true -p:PublishSingleFile=true -r win-arm64 -c Release -o __ga/win-arm64
dotnet publish ./src/Tur.csproj -f net8.0 /p:AssemblyVersion=${{ env.APP_VERSION }} /p:DebugType=None --self-contained true -v normal -p:PublishTrimmed=true -p:PublishSingleFile=true -r osx-x64 -c Release -o __ga/osx-x64
- name: Package Binaries
run: |
cd __ga
sudo tar -cvzf tur-linux-x64.tar.gz --directory=linux-x64 .
sudo tar -cvzf tur-linux-musl-x64.tar.gz --directory=linux-musl-x64 .
sudo tar -cvzf tur-linux-arm.tar.gz --directory=linux-arm .
sudo tar -cvzf tur-linux-arm64.tar.gz --directory=linux-arm64 .
cd win-x64 && sudo zip -r ../tur-win-x64.zip * && cd ..
cd win-x86 && sudo zip -r ../tur-win-x86.zip * && cd ..
cd win-arm64 && sudo zip -r ../tur-win-arm64.zip * && cd ..
cd osx-x64 && sudo zip -r ../tur-osx-x64.zip * && cd ..
- uses: dev-drprasad/[email protected]
name: Remove existing release for [${{ env.APP_VERSION }}]
with:
delete_release: true
tag_name: ${{ env.APP_VERSION }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: ncipollo/release-action@v1
name: publish release for [${{ env.APP_VERSION }}]
with:
artifacts: "__ga/*.gz,__ga/*zip"
token: ${{ secrets.GITHUB_TOKEN }}
removeArtifacts: true
tag: ${{ env.APP_VERSION }}
allowUpdates: true
name: ${{ env.APP_VERSION }}
commit: master
artifactErrorsFailBuild: true
body: "Changes could be found at [CHANGELOG](https://github.com/JerryBian/tur/blob/master/CHANGELOG.md#${{ env.APP_VERSION_LINK }})."
- uses: dev-drprasad/[email protected]
name: Remove existing release for [latest]
with:
delete_release: true
tag_name: latest
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: ncipollo/release-action@v1
name: publish release for [latest]
with:
artifacts: "__ga/*.gz,__ga/*zip"
token: ${{ secrets.GITHUB_TOKEN }}
removeArtifacts: true
tag: latest
allowUpdates: true
name: latest
commit: master
artifactErrorsFailBuild: true
body: "Changes could be found at [CHANGELOG](https://github.com/JerryBian/tur/blob/master/CHANGELOG.md#${{ env.APP_VERSION_LINK }})."