diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 7d3f941..654f708 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,30 +1,32 @@ -name: .NET +name: CI for dotnet on: push: - branches: [ "main" ] + branches: ["main"] paths-ignore: - - 'README.md' - - 'src/SingleOriginSolution/**' - - '.github/**' - - '.vscode/**' + - "README.md" + - "src/SingleOriginSolution/**" + - ".github/**" + - ".vscode/**" pull_request: - branches: [ "main" ] + branches: ["main"] jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Setup .NET - uses: actions/setup-dotnet@v3.0.3 - with: - dotnet-version: 6.0.x - - name: Restore dependencies - run: dotnet restore - - name: Build - run: dotnet build --no-restore - - name: Test - run: dotnet test --no-build --verbosity normal + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3.0.3 + with: + dotnet-version: 6.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Test + run: dotnet test --no-build --verbosity normal diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f4e09bb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Add Publish Artifacts to Release + +on: + release: + types: [published] + +jobs: + release: + name: Release + strategy: + matrix: + kind: ["windows"] + include: + - kind: windows + os: windows-latest + target: win-x64 + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup dotnet + uses: actions/setup-dotnet@v3.0.3 + + - name: Build + shell: bash + run: | + tag=$(git describe --tags --abbrev=0) + release_name="WebDLanding-$tag-${{ matrix.target }}" + # Build everything + dotnet publish src/WebDLanding/WebDLanding.csproj -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: "WebDLanding*.zip" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}