From 32eba8225a88c6c081c50caec8cff26ce916165a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Pivo=C5=88ka?= Date: Sun, 1 Sep 2024 03:48:24 +0200 Subject: [PATCH 1/3] Create pre-alpha-build.yml --- .github/workflows/pre-alpha-build.yml | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/pre-alpha-build.yml diff --git a/.github/workflows/pre-alpha-build.yml b/.github/workflows/pre-alpha-build.yml new file mode 100644 index 00000000..12c227f0 --- /dev/null +++ b/.github/workflows/pre-alpha-build.yml @@ -0,0 +1,58 @@ +name: Pre-Alpha Publish CLI + +on: + workflow_dispatch: + +env: + PROJECT_NAME: NationsConverterCLI + +jobs: + build: + runs-on: ubuntu-latest + name: Build + + env: + ZIP_SUFFIX: .zip + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Publish + run: dotnet publish Src/${{ env.PROJECT_NAME }} + -c Release + -r win-x64 + -o build/${{ env.PROJECT_NAME }} + -p:PublishTrimmed=true + -p:PublishSingleFile=true + -p:EnableCompressionInSingleFile=true + --self-contained + + - name: Zip to ${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }} + uses: thedoctor0/zip-release@main + with: + directory: build + path: ${{ env.PROJECT_NAME }} + filename: ../${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }} + + - name: Calculate SHA256 (Windows) + run: | + $hash = Get-FileHash -Path '${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}' -Algorithm SHA256 + $hashValue = $hash.Hash.ToLower() + Write-Host $hashValue + $hashValue | Out-File -FilePath "${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}.hash.txt" + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4 + with: + path: ${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }} + if-no-files-found: error From aa531fb57567b2752a17d74679e181a52f780b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Pivo=C5=88ka?= Date: Sun, 1 Sep 2024 03:50:40 +0200 Subject: [PATCH 2/3] Update pre-alpha-build.yml --- .github/workflows/pre-alpha-build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pre-alpha-build.yml b/.github/workflows/pre-alpha-build.yml index 12c227f0..7f6d1f06 100644 --- a/.github/workflows/pre-alpha-build.yml +++ b/.github/workflows/pre-alpha-build.yml @@ -23,9 +23,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - - - name: Restore dependencies - run: dotnet restore - name: Publish run: dotnet publish Src/${{ env.PROJECT_NAME }} From e73d5ff0acedb16f2fab61511c8ed71f346c64a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Pivo=C5=88ka?= Date: Sun, 1 Sep 2024 03:54:10 +0200 Subject: [PATCH 3/3] Update pre-alpha-build.yml --- .github/workflows/pre-alpha-build.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pre-alpha-build.yml b/.github/workflows/pre-alpha-build.yml index 7f6d1f06..7a22bb7d 100644 --- a/.github/workflows/pre-alpha-build.yml +++ b/.github/workflows/pre-alpha-build.yml @@ -41,12 +41,9 @@ jobs: path: ${{ env.PROJECT_NAME }} filename: ../${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }} - - name: Calculate SHA256 (Windows) + - name: Calculate SHA256 (Linux) run: | - $hash = Get-FileHash -Path '${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}' -Algorithm SHA256 - $hashValue = $hash.Hash.ToLower() - Write-Host $hashValue - $hashValue | Out-File -FilePath "${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}.hash.txt" + sha256sum "${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}" | awk '{print $1}' | tee >(cat) > ${{ env.PROJECT_NAME }}${{ env.ZIP_SUFFIX }}.hash.txt - name: Upload a Build Artifact uses: actions/upload-artifact@v4