From db29f750930692204d70f4869666964c81298b90 Mon Sep 17 00:00:00 2001 From: LaurentM-Ubi <81652553+LaurentM-Ubi@users.noreply.github.com> Date: Mon, 25 Apr 2022 11:54:09 +0200 Subject: [PATCH] Add CI (#3) * Add CI --- .github/workflows/ci.yml | 49 +++++++++++++++++++ Directory.Build.props | 1 + GitTimelapseView/GitTimelapseView.csproj | 1 + .../PublishProfiles/FolderProfile.pubxml | 14 ------ 4 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 GitTimelapseView/Properties/PublishProfiles/FolderProfile.pubxml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..744b752 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: publish + +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 + - 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" + + # 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 }} diff --git a/Directory.Build.props b/Directory.Build.props index debade0..2c71975 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -19,6 +19,7 @@ false $(DefaultItemExcludes);publish/**/* enable + false diff --git a/GitTimelapseView/GitTimelapseView.csproj b/GitTimelapseView/GitTimelapseView.csproj index beb4ea3..32f2071 100644 --- a/GitTimelapseView/GitTimelapseView.csproj +++ b/GitTimelapseView/GitTimelapseView.csproj @@ -4,6 +4,7 @@ WinExe true Wpf\Resources\appicon.ico + true diff --git a/GitTimelapseView/Properties/PublishProfiles/FolderProfile.pubxml b/GitTimelapseView/Properties/PublishProfiles/FolderProfile.pubxml deleted file mode 100644 index e3646a6..0000000 --- a/GitTimelapseView/Properties/PublishProfiles/FolderProfile.pubxml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Release - Any CPU - ..\publish\ - FileSystem - net6.0-windows - false - -