From 5192f7d79c8b52f05f1e2a647bdb14cbb385dfa2 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Sat, 8 Jun 2024 00:25:25 -0400 Subject: [PATCH 1/8] Added `release.yml` --- .github/workflows/release.yml | 298 ++++++++++++++++++++++++++++++++++ 1 file changed, 298 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..057a3d3405 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,298 @@ +name: Release (neo-cli) + +on: + release: + types: [published] + +env: + DOTNET_VERSION: 8.0.x + CONFIGURATION: Release + DIST_PATH: /tmp/dist + OUTPUT_PATH: /tmp/out + +jobs: + build-leveldb: + name: Build leveldb (windows-latest) + runs-on: windows-latest + strategy: + matrix: + arch: [x64, arm64] + + steps: + - name: Lookup Cache Distribution + id: cache-leveldb + uses: actions/cache@v4 + with: + path: ./leveldb/build/Release/* + key: leveldb-windows-${{ matrix.arch }} + enableCrossOsArchive: true + lookup-only: true + + - if: ${{ steps.cache-leveldb.outputs.cache-hit != 'true' }} + name: Checkout Repository Code (leveldb) + uses: actions/checkout@v4 + with: + repository: google/leveldb + path: leveldb + submodules: true + fetch-depth: 0 + + - if: ${{ steps.cache-leveldb.outputs.cache-hit != 'true' }} + name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - if: ${{ steps.cache-leveldb.outputs.cache-hit != 'true' }} + name: Setup LevelDb + working-directory: ./leveldb + run: mkdir -p ./build/Release + + - if: ${{ steps.cache-leveldb.outputs.cache-hit != 'true' }} + name: Create Build Files (win-${{ matrix.arch }}) + working-directory: ./leveldb/build + run: cmake -DBUILD_SHARED_LIBS=ON -A ${{ matrix.arch }} .. + + - if: ${{ steps.cache-leveldb.outputs.cache-hit != 'true' }} + name: Build (MSBuild) + working-directory: ./leveldb/build + run: msbuild ./leveldb.sln /p:Configuration=Release + + - if: ${{ steps.cache-leveldb.outputs.cache-hit != 'true' }} + name: Cache Distribution + uses: actions/cache/save@v4 + with: + path: ./leveldb/build/Release/* + key: leveldb-windows-${{ matrix.arch }} + enableCrossOsArchive: true + + build-neo-cli: + needs: [build-leveldb] + name: Build TarBalls (${{ matrix.runtime }}) + runs-on: ubuntu-latest + strategy: + matrix: + runtime: [linux-x64, linux-arm64, win-x64, win-arm64] + + steps: + - name: Set Application Version (Environment Variable) + run: | + APP_VERSION=$(echo '${{ github.event.release.tag_name }}' | cut -d 'v' -f 2) + echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV + + - name: Checkout Repository Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: .NET Publish (neo-cli) + working-directory: ./neo + run: | + dotnet publish ./src/Neo.CLI \ + --version-suffix ${{ env.APP_VERSION }} + --framework net8.0 \ + --configuration ${{ env.CONFIGURATION }} \ + --runtime ${{ matrix.runtime }} \ + --self-contained true \ + --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} \ + --verbosity normal \ + -p:RuntimeIdentifier=${{ matrix.runtime }} \ + -p:SelfContained=true \ + -p:IncludeNativeLibrariesForSelfExtract=false \ + -p:PublishTrimmed=false \ + -p:PublishSingleFile=true \ + -p:PublishReadyToRun=true \ + -p:EnableCompressionInSingleFile=true \ + -p:DebugType=embedded \ + -p:ServerGarbageCollection=true + + - name: .NET Build (LevelDBStore) + run: | + dotnet build ./src/Plugins/LevelDBStore/LevelDBStore.csproj \ + --framework net8.0 \ + --configuration ${{ env.CONFIGURATION }} \ + --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/Plugins/LevelDBStore \ + --verbosity normal + + - name: Remove Xml Comment Files + working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} + run: rm -v *.xml + + - if: ${{ startsWith(matrix.runtime, 'win-x64') }} + name: Get Distribution Caches (win-x64) + uses: actions/cache@v4 + with: + path: ./leveldb/build/Release/* + key: leveldb-windows-x64 + enableCrossOsArchive: true + fail-on-cache-miss: true + + - if: ${{ startsWith(matrix.runtime, 'win-arm64') }} + name: Get Distribution Caches (win-arm64) + uses: actions/cache@v4 + with: + path: ./leveldb/build/Release/* + key: leveldb-windows-arm64 + enableCrossOsArchive: true + fail-on-cache-miss: true + + - if: ${{ startsWith(matrix.runtime, 'win') }} + name: Copy Files (leveldb) (win) + run: cp -v ./leveldb/build/Release/leveldb.dll ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/libleveldb.dll + + - name: Create Distribution Directory + run: mkdir -p ${{ env.DIST_PATH }} + + - name: Create Tarball File (linux) + if: ${{ startsWith(matrix.runtime, 'linux') }} + working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} + run: tar -czvf ${{ env.DIST_PATH }}/neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }}.tar.gz . + + - name: Create Zip File (win) + if: ${{ startsWith(matrix.runtime, 'win') }} + working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} + run: zip ${{ env.DIST_PATH }}/neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }}.zip -r * + + - name: Create Checksum Files + working-directory: ${{ env.DIST_PATH }} + env: + FILENAME: neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }} + run: | + sha256sum ${{ env.FILENAME }}.tar.gz > ${{ env.FILENAME }}.sha256 + sha256sum ${{ env.FILENAME }}.zip > ${{ env.FILENAME }}.sha256 + + - name: Output/Distribution Directory Contents + run: | + ls -la ${{ env.DIST_PATH }} + ls -la ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} + + - name: Upload Tarball File (linux) + if: ${{ startsWith(matrix.runtime, 'linux') }} + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ env.DIST_PATH }}/neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }}.tar.gz + asset_name: neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }}.tar.gz + asset_content_type: application/x-gtar + + - name: Upload Zip File (win) + if: ${{ startsWith(matrix.runtime, 'win') }} + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ env.DIST_PATH }}/neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }}.zip + asset_name: neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }}.zip + asset_content_type: application/zip + + # codesign-macos: + # name: Build TarBalls (${{ matrix.runtime }}) + # runs-on: macos-latest + # strategy: + # matrix: + # runtime: [osx-x64, osx-arm64] + + # steps: + # - name: Set Application Version (Environment Variable) + # run: | + # APP_VERSION=$(echo '${{ github.event.release.tag_name }}' | cut -d 'v' -f 2) + # echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV + + # - name: Checkout Repository Code + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + + # - name: Setup .NET + # uses: actions/setup-dotnet@v4 + # with: + # dotnet-version: ${{ env.DOTNET_VERSION }} + + # - name: .NET Publish (neo-cli) + # working-directory: ./neo + # run: | + # dotnet publish ./src/Neo.CLI \ + # --version-suffix ${{ env.APP_VERSION }} + # --framework net8.0 \ + # --configuration ${{ env.CONFIGURATION }} \ + # --runtime ${{ matrix.runtime }} \ + # --self-contained true \ + # --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} \ + # --verbosity normal \ + # -p:RuntimeIdentifier=${{ matrix.runtime }} \ + # -p:SelfContained=true \ + # -p:IncludeNativeLibrariesForSelfExtract=false \ + # -p:PublishTrimmed=false \ + # -p:PublishSingleFile=true \ + # -p:PublishReadyToRun=true \ + # -p:EnableCompressionInSingleFile=true \ + # -p:DebugType=embedded \ + # -p:ServerGarbageCollection=true + + # - name: .NET Build (LevelDBStore) + # working-directory: ./neo-modules + # run: | + # dotnet build ./src/Plugins/LevelDBStore/LevelDBStore.csproj \ + # --framework net8.0 \ + # --configuration ${{ env.CONFIGURATION }} \ + # --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/Plugins/LevelDBStore \ + # --verbosity normal + + # - name: Remove Xml Comment Files + # working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} + # run: rm -v *.xml + + # - name: CodeSign (neo-cli) + # working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} + # run: codesign --force --deep -s - neo-cli + + # - name: Create Distribution Directory + # run: mkdir -p ${{ env.DIST_PATH }} + + # - name: Create Tarball File + # working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} + # run: tar -cJf ${{ env.DIST_PATH }}/neo-cli-${{ matrix.runtime }}-${{ github.event.inputs.version }}.tar.xz . + + # - name: Output/Distribution Directory Contents + # run: | + # ls -la ${{ env.DIST_PATH }} + # ls -la ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} + + # - name: Cache Distribution + # uses: actions/cache/save@v3 + # with: + # path: ${{ env.DIST_PATH }}/* + # key: ${{ matrix.runtime }} + + cleanup: + needs: [release-neo-cli] + runs-on: ubuntu-latest + steps: + - name: Cleanup + run: | + gh extension install actions/gh-actions-cache + + echo "Fetching list of cache key" + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 ) + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + if [ "$cacheKey" != "leveldb-windows-x64" ] && [ "$cacheKey" != "leveldb-windows-arm64" ] + then + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm + fi + done + echo "Done" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + BRANCH: ${{ github.ref }} From 1b44827acf67def8de9d11d0c7eedc1ac653238f Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Sat, 8 Jun 2024 05:22:11 -0400 Subject: [PATCH 2/8] Fixed `release.yml` --- .github/workflows/release.yml | 158 ++++++++++++++-------------------- 1 file changed, 65 insertions(+), 93 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 057a3d3405..2ff816f697 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -66,11 +66,11 @@ jobs: build-neo-cli: needs: [build-leveldb] - name: Build TarBalls (${{ matrix.runtime }}) + name: Build & Publish TarBalls (${{ matrix.runtime }}) runs-on: ubuntu-latest strategy: matrix: - runtime: [linux-x64, linux-arm64, win-x64, win-arm64] + runtime: [linux-x64, linux-arm64, win-x64, win-arm64, osx-x64, osx-arm64] steps: - name: Set Application Version (Environment Variable) @@ -89,16 +89,16 @@ jobs: dotnet-version: ${{ env.DOTNET_VERSION }} - name: .NET Publish (neo-cli) - working-directory: ./neo run: | dotnet publish ./src/Neo.CLI \ - --version-suffix ${{ env.APP_VERSION }} + --version-suffix ${{ matrix.runtime }} \ --framework net8.0 \ --configuration ${{ env.CONFIGURATION }} \ --runtime ${{ matrix.runtime }} \ --self-contained true \ --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} \ --verbosity normal \ + -p:VersionPrefix=${{ env.APP_VERSION }} \ -p:RuntimeIdentifier=${{ matrix.runtime }} \ -p:SelfContained=true \ -p:IncludeNativeLibrariesForSelfExtract=false \ @@ -111,11 +111,20 @@ jobs: - name: .NET Build (LevelDBStore) run: | - dotnet build ./src/Plugins/LevelDBStore/LevelDBStore.csproj \ + dotnet build ./src/Plugins/LevelDBStore \ + --version-suffix ${{ matrix.runtime }} \ --framework net8.0 \ --configuration ${{ env.CONFIGURATION }} \ --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/Plugins/LevelDBStore \ - --verbosity normal + --verbosity normal \ + -p:VersionPrefix=${{ env.APP_VERSION }} + + - name: Remove files (junk) + working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/Plugins/LevelDBStore + run: | + rm -v Neo* + rm -v *.pdb + rm -v *.xml - name: Remove Xml Comment Files working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} @@ -149,19 +158,40 @@ jobs: - name: Create Tarball File (linux) if: ${{ startsWith(matrix.runtime, 'linux') }} working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} - run: tar -czvf ${{ env.DIST_PATH }}/neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }}.tar.gz . + run: tar -czvf ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.gz . + + - name: Create Tarball File (osx) + if: ${{ startsWith(matrix.runtime, 'osx') }} + working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} + run: tar -cJf ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz . - name: Create Zip File (win) if: ${{ startsWith(matrix.runtime, 'win') }} working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} - run: zip ${{ env.DIST_PATH }}/neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }}.zip -r * + run: zip ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.zip -r * - - name: Create Checksum Files + - name: Create Checksum Files (linux) + if: ${{ startsWith(matrix.runtime, 'linux') }} working-directory: ${{ env.DIST_PATH }} env: - FILENAME: neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }} + FILENAME: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }} run: | sha256sum ${{ env.FILENAME }}.tar.gz > ${{ env.FILENAME }}.sha256 + + - name: Create Checksum Files (osx) + if: ${{ startsWith(matrix.runtime, 'osx') }} + working-directory: ${{ env.DIST_PATH }} + env: + FILENAME: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }} + run: | + sha256sum ${{ env.FILENAME }}.tar.xz > ${{ env.FILENAME }}.sha256 + + - name: Create Checksum Files (win) + if: ${{ startsWith(matrix.runtime, 'win') }} + working-directory: ${{ env.DIST_PATH }} + env: + FILENAME: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }} + run: | sha256sum ${{ env.FILENAME }}.zip > ${{ env.FILENAME }}.sha256 - name: Output/Distribution Directory Contents @@ -176,8 +206,19 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ env.DIST_PATH }}/neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }}.tar.gz - asset_name: neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }}.tar.gz + asset_path: ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.gz + asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.gz + asset_content_type: application/x-gtar + + - name: Upload Tarball File (osx) + if: ${{ startsWith(matrix.runtime, 'osx') }} + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz + asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz asset_content_type: application/x-gtar - name: Upload Zip File (win) @@ -187,91 +228,22 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ env.DIST_PATH }}/neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }}.zip - asset_name: neo-cli-${{ matrix.runtime }}.v${{ env.APP_VERSION }}.zip + asset_path: ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.zip + asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.zip asset_content_type: application/zip - # codesign-macos: - # name: Build TarBalls (${{ matrix.runtime }}) - # runs-on: macos-latest - # strategy: - # matrix: - # runtime: [osx-x64, osx-arm64] - - # steps: - # - name: Set Application Version (Environment Variable) - # run: | - # APP_VERSION=$(echo '${{ github.event.release.tag_name }}' | cut -d 'v' -f 2) - # echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV - - # - name: Checkout Repository Code - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - - # - name: Setup .NET - # uses: actions/setup-dotnet@v4 - # with: - # dotnet-version: ${{ env.DOTNET_VERSION }} - - # - name: .NET Publish (neo-cli) - # working-directory: ./neo - # run: | - # dotnet publish ./src/Neo.CLI \ - # --version-suffix ${{ env.APP_VERSION }} - # --framework net8.0 \ - # --configuration ${{ env.CONFIGURATION }} \ - # --runtime ${{ matrix.runtime }} \ - # --self-contained true \ - # --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} \ - # --verbosity normal \ - # -p:RuntimeIdentifier=${{ matrix.runtime }} \ - # -p:SelfContained=true \ - # -p:IncludeNativeLibrariesForSelfExtract=false \ - # -p:PublishTrimmed=false \ - # -p:PublishSingleFile=true \ - # -p:PublishReadyToRun=true \ - # -p:EnableCompressionInSingleFile=true \ - # -p:DebugType=embedded \ - # -p:ServerGarbageCollection=true - - # - name: .NET Build (LevelDBStore) - # working-directory: ./neo-modules - # run: | - # dotnet build ./src/Plugins/LevelDBStore/LevelDBStore.csproj \ - # --framework net8.0 \ - # --configuration ${{ env.CONFIGURATION }} \ - # --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/Plugins/LevelDBStore \ - # --verbosity normal - - # - name: Remove Xml Comment Files - # working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} - # run: rm -v *.xml - - # - name: CodeSign (neo-cli) - # working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} - # run: codesign --force --deep -s - neo-cli - - # - name: Create Distribution Directory - # run: mkdir -p ${{ env.DIST_PATH }} - - # - name: Create Tarball File - # working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} - # run: tar -cJf ${{ env.DIST_PATH }}/neo-cli-${{ matrix.runtime }}-${{ github.event.inputs.version }}.tar.xz . - - # - name: Output/Distribution Directory Contents - # run: | - # ls -la ${{ env.DIST_PATH }} - # ls -la ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} - - # - name: Cache Distribution - # uses: actions/cache/save@v3 - # with: - # path: ${{ env.DIST_PATH }}/* - # key: ${{ matrix.runtime }} + - name: Upload Checksum File (all) + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.sha256 + asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.sha256 + asset_content_type: text/plain cleanup: - needs: [release-neo-cli] + needs: [build-neo-cli] runs-on: ubuntu-latest steps: - name: Cleanup From 72416f0413613c266466195b32c1be875bcdcce0 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Sat, 8 Jun 2024 05:45:01 -0400 Subject: [PATCH 3/8] Remove `VersionPrefix` --- src/Directory.Build.props | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index c211ee34aa..63fd091f7e 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,7 +3,6 @@ 2015-2024 The Neo Project - 3.7.4 12.0 The Neo Project neo.png From 1910f3b24a727fb68443db6f00f3bda37534d256 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Sat, 15 Jun 2024 05:31:32 -0400 Subject: [PATCH 4/8] Added macos leveldb --- .github/workflows/release.yml | 122 +++++++++++++++++++++++++--------- 1 file changed, 90 insertions(+), 32 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2ff816f697..5e507c0225 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,11 @@ name: Release (neo-cli) +# Trigger the workflow on a release event when a new release is published on: release: types: [published] +# Define environment variables env: DOTNET_VERSION: 8.0.x CONFIGURATION: Release @@ -13,21 +15,24 @@ env: jobs: build-leveldb: name: Build leveldb (windows-latest) - runs-on: windows-latest + runs-on: ${{ matrix.os }} strategy: matrix: + os: [macos-latest, windows-latest] arch: [x64, arm64] steps: + # Step to lookup cache for the LevelDB build distribution - name: Lookup Cache Distribution id: cache-leveldb uses: actions/cache@v4 with: path: ./leveldb/build/Release/* - key: leveldb-windows-${{ matrix.arch }} + key: leveldb-${{ matrix.os }}-${{ matrix.arch }} enableCrossOsArchive: true lookup-only: true + # Conditionally checkout LevelDB repository if cache is not found - if: ${{ steps.cache-leveldb.outputs.cache-hit != 'true' }} name: Checkout Repository Code (leveldb) uses: actions/checkout@v4 @@ -37,31 +42,36 @@ jobs: submodules: true fetch-depth: 0 - - if: ${{ steps.cache-leveldb.outputs.cache-hit != 'true' }} + # Conditionally setup MSBuild if cache is not found + - if: ${{ matrix.os == 'windows-latest' && steps.cache-leveldb.outputs.cache-hit != 'true' }} name: Setup MSBuild uses: microsoft/setup-msbuild@v2 + # Conditionally setup LevelDB build directory if cache is not found - if: ${{ steps.cache-leveldb.outputs.cache-hit != 'true' }} name: Setup LevelDb working-directory: ./leveldb run: mkdir -p ./build/Release + # Conditionally create build files for LevelDB if cache is not found - if: ${{ steps.cache-leveldb.outputs.cache-hit != 'true' }} name: Create Build Files (win-${{ matrix.arch }}) working-directory: ./leveldb/build run: cmake -DBUILD_SHARED_LIBS=ON -A ${{ matrix.arch }} .. - - if: ${{ steps.cache-leveldb.outputs.cache-hit != 'true' }} + # Conditionally build LevelDB using MSBuild if cache is not found + - if: ${{ matrix.os == 'windows-latest' && steps.cache-leveldb.outputs.cache-hit != 'true' }} name: Build (MSBuild) working-directory: ./leveldb/build run: msbuild ./leveldb.sln /p:Configuration=Release + # Conditionally cache the LevelDB distribution if it was built - if: ${{ steps.cache-leveldb.outputs.cache-hit != 'true' }} name: Cache Distribution uses: actions/cache/save@v4 with: path: ./leveldb/build/Release/* - key: leveldb-windows-${{ matrix.arch }} + key: leveldb-${{ matrix.os }}-${{ matrix.arch }} enableCrossOsArchive: true build-neo-cli: @@ -73,52 +83,58 @@ jobs: runtime: [linux-x64, linux-arm64, win-x64, win-arm64, osx-x64, osx-arm64] steps: + # Step to set the application version from the release tag - name: Set Application Version (Environment Variable) run: | APP_VERSION=$(echo '${{ github.event.release.tag_name }}' | cut -d 'v' -f 2) echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV + # Checkout the neo-cli repository code - name: Checkout Repository Code uses: actions/checkout@v4 with: fetch-depth: 0 + # Setup .NET environment - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} + # Publish the neo-cli project - name: .NET Publish (neo-cli) run: | dotnet publish ./src/Neo.CLI \ - --version-suffix ${{ matrix.runtime }} \ - --framework net8.0 \ - --configuration ${{ env.CONFIGURATION }} \ - --runtime ${{ matrix.runtime }} \ - --self-contained true \ - --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} \ - --verbosity normal \ - -p:VersionPrefix=${{ env.APP_VERSION }} \ - -p:RuntimeIdentifier=${{ matrix.runtime }} \ - -p:SelfContained=true \ - -p:IncludeNativeLibrariesForSelfExtract=false \ - -p:PublishTrimmed=false \ - -p:PublishSingleFile=true \ - -p:PublishReadyToRun=true \ - -p:EnableCompressionInSingleFile=true \ - -p:DebugType=embedded \ - -p:ServerGarbageCollection=true - + --version-suffix ${{ matrix.runtime }} \ # Append runtime identifier to version + --framework net8.0 \ # Target .NET 8.0 framework + --configuration ${{ env.CONFIGURATION }} \ # Use Release configuration + --runtime ${{ matrix.runtime }} \ # Specify runtime identifier (e.g., win-x64, linux-arm64) + --self-contained true \ # Include the .NET runtime with the application + --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} \ # Output path for the published application + --verbosity normal \ # Normal verbosity level + -p:VersionPrefix=${{ env.APP_VERSION }} \ # Set the version prefix to the application version + -p:RuntimeIdentifier=${{ matrix.runtime }} \ # Set the runtime identifier property + -p:SelfContained=true \ # Ensure the application is self-contained + -p:IncludeNativeLibrariesForSelfExtract=false \ # Do not include native libraries for self-extraction + -p:PublishTrimmed=false \ # Do not trim unused code + -p:PublishSingleFile=true \ # Publish as a single file + -p:PublishReadyToRun=true \ # Enable ReadyToRun compilation + -p:EnableCompressionInSingleFile=true \ # Enable compression in the single file + -p:DebugType=embedded \ # Embed debug information + -p:ServerGarbageCollection=true # Enable server garbage collection + + # Build the LevelDBStore plugin - name: .NET Build (LevelDBStore) run: | dotnet build ./src/Plugins/LevelDBStore \ - --version-suffix ${{ matrix.runtime }} \ - --framework net8.0 \ - --configuration ${{ env.CONFIGURATION }} \ - --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/Plugins/LevelDBStore \ - --verbosity normal \ - -p:VersionPrefix=${{ env.APP_VERSION }} - + --version-suffix ${{ matrix.runtime }} \ # Append runtime identifier to version + --framework net8.0 \ # Target .NET 8.0 framework + --configuration ${{ env.CONFIGURATION }} \ # Use Release configuration + --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/Plugins/LevelDBStore \ # Output path for the built plugin + --verbosity normal \ # Normal verbosity level + -p:VersionPrefix=${{ env.APP_VERSION }} # Set the version prefix to the application version + + # Remove unnecessary files from the LevelDBStore plugin output - name: Remove files (junk) working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/Plugins/LevelDBStore run: | @@ -126,50 +142,84 @@ jobs: rm -v *.pdb rm -v *.xml + # Remove XML comment files from the neo-cli output - name: Remove Xml Comment Files working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} run: rm -v *.xml + # Get cached LevelDB distribution for Windows x64 if applicable - if: ${{ startsWith(matrix.runtime, 'win-x64') }} name: Get Distribution Caches (win-x64) uses: actions/cache@v4 with: path: ./leveldb/build/Release/* - key: leveldb-windows-x64 + key: leveldb-windows-latest-x64 enableCrossOsArchive: true fail-on-cache-miss: true + # Get cached LevelDB distribution for Windows arm64 if applicable - if: ${{ startsWith(matrix.runtime, 'win-arm64') }} name: Get Distribution Caches (win-arm64) uses: actions/cache@v4 with: path: ./leveldb/build/Release/* - key: leveldb-windows-arm64 + key: leveldb-windows-latest-arm64 + enableCrossOsArchive: true + fail-on-cache-miss: true + + # Get cached LevelDB distribution for OSX x64 if applicable + - if: ${{ startsWith(matrix.runtime, 'osx-x64') }} + name: Get Distribution Caches (win-arm64) + uses: actions/cache@v4 + with: + path: ./leveldb/build/Release/* + key: leveldb-macos-latest-x64 + enableCrossOsArchive: true + fail-on-cache-miss: true + + # Get cached LevelDB distribution for OSX arm64 if applicable + - if: ${{ startsWith(matrix.runtime, 'osx-arm64') }} + name: Get Distribution Caches (win-arm64) + uses: actions/cache@v4 + with: + path: ./leveldb/build/Release/* + key: leveldb-macos-latest-arm64 enableCrossOsArchive: true fail-on-cache-miss: true + # Copy LevelDB files to the output directory for Windows - if: ${{ startsWith(matrix.runtime, 'win') }} name: Copy Files (leveldb) (win) run: cp -v ./leveldb/build/Release/leveldb.dll ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/libleveldb.dll + # Copy LevelDB files to the output directory for MacOS + - if: ${{ startsWith(matrix.runtime, 'osx') }} + name: Copy Files (leveldb) (win) + run: cp -v ./leveldb/build/Release/leveldb.dylib ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/libleveldb.dylib + + # Create the distribution directory - name: Create Distribution Directory run: mkdir -p ${{ env.DIST_PATH }} + # Create a tarball file for Linux distributions - name: Create Tarball File (linux) if: ${{ startsWith(matrix.runtime, 'linux') }} working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} run: tar -czvf ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.gz . + # Create a tarball file for macOS distributions - name: Create Tarball File (osx) if: ${{ startsWith(matrix.runtime, 'osx') }} working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} run: tar -cJf ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz . + # Create a zip file for Windows distributions - name: Create Zip File (win) if: ${{ startsWith(matrix.runtime, 'win') }} working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} run: zip ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.zip -r * + # Create checksum files for Linux distributions - name: Create Checksum Files (linux) if: ${{ startsWith(matrix.runtime, 'linux') }} working-directory: ${{ env.DIST_PATH }} @@ -178,6 +228,7 @@ jobs: run: | sha256sum ${{ env.FILENAME }}.tar.gz > ${{ env.FILENAME }}.sha256 + # Create checksum files for macOS distributions - name: Create Checksum Files (osx) if: ${{ startsWith(matrix.runtime, 'osx') }} working-directory: ${{ env.DIST_PATH }} @@ -186,6 +237,7 @@ jobs: run: | sha256sum ${{ env.FILENAME }}.tar.xz > ${{ env.FILENAME }}.sha256 + # Create checksum files for Windows distributions - name: Create Checksum Files (win) if: ${{ startsWith(matrix.runtime, 'win') }} working-directory: ${{ env.DIST_PATH }} @@ -194,11 +246,13 @@ jobs: run: | sha256sum ${{ env.FILENAME }}.zip > ${{ env.FILENAME }}.sha256 + # List the contents of the distribution and output directories - name: Output/Distribution Directory Contents run: | ls -la ${{ env.DIST_PATH }} ls -la ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} + # Upload tarball files for Linux distributions - name: Upload Tarball File (linux) if: ${{ startsWith(matrix.runtime, 'linux') }} uses: actions/upload-release-asset@latest @@ -210,6 +264,7 @@ jobs: asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.gz asset_content_type: application/x-gtar + # Upload tarball files for macOS distributions - name: Upload Tarball File (osx) if: ${{ startsWith(matrix.runtime, 'osx') }} uses: actions/upload-release-asset@latest @@ -221,6 +276,7 @@ jobs: asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz asset_content_type: application/x-gtar + # Upload zip files for Windows distributions - name: Upload Zip File (win) if: ${{ startsWith(matrix.runtime, 'win') }} uses: actions/upload-release-asset@latest @@ -232,6 +288,7 @@ jobs: asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.zip asset_content_type: application/zip + # Upload checksum files for all distributions - name: Upload Checksum File (all) uses: actions/upload-release-asset@latest env: @@ -246,6 +303,7 @@ jobs: needs: [build-neo-cli] runs-on: ubuntu-latest steps: + # Cleanup step to delete old caches - name: Cleanup run: | gh extension install actions/gh-actions-cache From 4486728be8d771ece9bc11b09f58316722d3d296 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Sat, 15 Jun 2024 06:40:07 -0400 Subject: [PATCH 5/8] Fixed --- .github/workflows/release.yml | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e507c0225..abbf8a030f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, windows-latest] + os: [windows-latest] arch: [x64, arm64] steps: @@ -167,36 +167,11 @@ jobs: enableCrossOsArchive: true fail-on-cache-miss: true - # Get cached LevelDB distribution for OSX x64 if applicable - - if: ${{ startsWith(matrix.runtime, 'osx-x64') }} - name: Get Distribution Caches (win-arm64) - uses: actions/cache@v4 - with: - path: ./leveldb/build/Release/* - key: leveldb-macos-latest-x64 - enableCrossOsArchive: true - fail-on-cache-miss: true - - # Get cached LevelDB distribution for OSX arm64 if applicable - - if: ${{ startsWith(matrix.runtime, 'osx-arm64') }} - name: Get Distribution Caches (win-arm64) - uses: actions/cache@v4 - with: - path: ./leveldb/build/Release/* - key: leveldb-macos-latest-arm64 - enableCrossOsArchive: true - fail-on-cache-miss: true - # Copy LevelDB files to the output directory for Windows - if: ${{ startsWith(matrix.runtime, 'win') }} name: Copy Files (leveldb) (win) run: cp -v ./leveldb/build/Release/leveldb.dll ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/libleveldb.dll - # Copy LevelDB files to the output directory for MacOS - - if: ${{ startsWith(matrix.runtime, 'osx') }} - name: Copy Files (leveldb) (win) - run: cp -v ./leveldb/build/Release/leveldb.dylib ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/libleveldb.dylib - # Create the distribution directory - name: Create Distribution Directory run: mkdir -p ${{ env.DIST_PATH }} From c6eea509581d342bda2a54c4da4da28129d6f3a3 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Wed, 19 Jun 2024 01:52:48 -0400 Subject: [PATCH 6/8] Remove comments on the command-line --- .github/workflows/release.yml | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index abbf8a030f..daaa6a8bbc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ env: jobs: build-leveldb: - name: Build leveldb (windows-latest) + name: Build leveldb win-${{ matrix.arch }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -105,34 +105,34 @@ jobs: - name: .NET Publish (neo-cli) run: | dotnet publish ./src/Neo.CLI \ - --version-suffix ${{ matrix.runtime }} \ # Append runtime identifier to version - --framework net8.0 \ # Target .NET 8.0 framework - --configuration ${{ env.CONFIGURATION }} \ # Use Release configuration - --runtime ${{ matrix.runtime }} \ # Specify runtime identifier (e.g., win-x64, linux-arm64) - --self-contained true \ # Include the .NET runtime with the application - --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} \ # Output path for the published application - --verbosity normal \ # Normal verbosity level - -p:VersionPrefix=${{ env.APP_VERSION }} \ # Set the version prefix to the application version - -p:RuntimeIdentifier=${{ matrix.runtime }} \ # Set the runtime identifier property - -p:SelfContained=true \ # Ensure the application is self-contained - -p:IncludeNativeLibrariesForSelfExtract=false \ # Do not include native libraries for self-extraction - -p:PublishTrimmed=false \ # Do not trim unused code - -p:PublishSingleFile=true \ # Publish as a single file - -p:PublishReadyToRun=true \ # Enable ReadyToRun compilation - -p:EnableCompressionInSingleFile=true \ # Enable compression in the single file - -p:DebugType=embedded \ # Embed debug information - -p:ServerGarbageCollection=true # Enable server garbage collection + --version-suffix ${{ matrix.runtime }} \ + --framework net8.0 \ + --configuration ${{ env.CONFIGURATION }} \ + --runtime ${{ matrix.runtime }} \ + --self-contained true \ + --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} \ + --verbosity normal \ + -p:VersionPrefix=${{ env.APP_VERSION }} \ + -p:RuntimeIdentifier=${{ matrix.runtime }} \ + -p:SelfContained=true \ + -p:IncludeNativeLibrariesForSelfExtract=false \ + -p:PublishTrimmed=false \ + -p:PublishSingleFile=true \ + -p:PublishReadyToRun=true \ + -p:EnableCompressionInSingleFile=true \ + -p:DebugType=embedded \ + -p:ServerGarbageCollection=true # Build the LevelDBStore plugin - name: .NET Build (LevelDBStore) run: | dotnet build ./src/Plugins/LevelDBStore \ - --version-suffix ${{ matrix.runtime }} \ # Append runtime identifier to version - --framework net8.0 \ # Target .NET 8.0 framework - --configuration ${{ env.CONFIGURATION }} \ # Use Release configuration - --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/Plugins/LevelDBStore \ # Output path for the built plugin - --verbosity normal \ # Normal verbosity level - -p:VersionPrefix=${{ env.APP_VERSION }} # Set the version prefix to the application version + --version-suffix ${{ matrix.runtime }} \ + --framework net8.0 \ + --configuration ${{ env.CONFIGURATION }} \ + --output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/Plugins/LevelDBStore \ + --verbosity normal \ + -p:VersionPrefix=${{ env.APP_VERSION }} # Remove unnecessary files from the LevelDBStore plugin output - name: Remove files (junk) From ab7aa31c99a50c4d5da2faf535c1b063d12e1e42 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Sun, 23 Jun 2024 19:48:59 -0400 Subject: [PATCH 7/8] Fixed `CodeSign` `neo-cli` --- .github/workflows/release.yml | 99 ++++++++++++++++++++++++++--------- 1 file changed, 73 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index daaa6a8bbc..6337d033ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -183,10 +183,12 @@ jobs: run: tar -czvf ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.gz . # Create a tarball file for macOS distributions - - name: Create Tarball File (osx) - if: ${{ startsWith(matrix.runtime, 'osx') }} - working-directory: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }} - run: tar -cJf ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz . + - name: Cache Distribution + uses: actions/cache/save@v4 + with: + path: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/* + key: leveldb-${{ matrix.os }}-${{ matrix.arch }} + enableCrossOsArchive: true # Create a zip file for Windows distributions - name: Create Zip File (win) @@ -203,15 +205,6 @@ jobs: run: | sha256sum ${{ env.FILENAME }}.tar.gz > ${{ env.FILENAME }}.sha256 - # Create checksum files for macOS distributions - - name: Create Checksum Files (osx) - if: ${{ startsWith(matrix.runtime, 'osx') }} - working-directory: ${{ env.DIST_PATH }} - env: - FILENAME: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }} - run: | - sha256sum ${{ env.FILENAME }}.tar.xz > ${{ env.FILENAME }}.sha256 - # Create checksum files for Windows distributions - name: Create Checksum Files (win) if: ${{ startsWith(matrix.runtime, 'win') }} @@ -239,18 +232,6 @@ jobs: asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.gz asset_content_type: application/x-gtar - # Upload tarball files for macOS distributions - - name: Upload Tarball File (osx) - if: ${{ startsWith(matrix.runtime, 'osx') }} - uses: actions/upload-release-asset@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz - asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz - asset_content_type: application/x-gtar - # Upload zip files for Windows distributions - name: Upload Zip File (win) if: ${{ startsWith(matrix.runtime, 'win') }} @@ -274,9 +255,75 @@ jobs: asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.sha256 asset_content_type: text/plain + code-sign: + needs: [build-neo-cli] + name: CodeSign & Publish (neo-cli) ${{ matrix.arch }} + runs-on: macos-latest + strategy: + matrix: + arch: [x64, arm64] + + steps: + # Step to set the application version from the release tag + - name: Set Application Version (Environment Variable) + run: | + APP_VERSION=$(echo '${{ github.event.release.tag_name }}' | cut -d 'v' -f 2) + echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV + + - name: Get Distribution Caches (win-${{ matrix.arch}}) + uses: actions/cache@v4 + with: + path: ${{ env.OUTPUT_PATH }}/osx-${{ matrix.arch }}/* + key: neo-macos-latest-${{ matrix.arch }} + enableCrossOsArchive: true + fail-on-cache-miss: true + + - name: Sign (neo-cli) + working-directory: ${{ env.OUTPUT_PATH }}/osx-${{ matrix.arch }} + run: codesign --force --deep -s - neo-cli + + # Create a tarball file for macOS distributions + - name: Create Tarball File (osx) + if: ${{ startsWith(matrix.runtime, 'osx') }} + working-directory: ${{ env.OUTPUT_PATH }}/osx-${{ matrix.arch }} + run: tar -cJf ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-osx-${{ matrix.arch }}.tar.xz . + + # Create checksum files for macOS distributions + - name: Create Checksum Files (osx) + if: ${{ startsWith(matrix.runtime, 'osx') }} + working-directory: ${{ env.DIST_PATH }} + env: + FILENAME: neo-cli.v${{ env.APP_VERSION }}-osx-${{ matrix.arch }} + run: | + sha256sum ${{ env.FILENAME }}.tar.xz > ${{ env.FILENAME }}.sha256 + + # Upload tarball files for macOS distributions + - name: Upload Tarball File (osx) + if: ${{ startsWith(matrix.runtime, 'osx') }} + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz + asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz + asset_content_type: application/x-gtar + + # Upload checksum files for all distributions + - name: Upload Checksum File (all) + uses: actions/upload-release-asset@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.sha256 + asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.sha256 + asset_content_type: text/plain + cleanup: needs: [build-neo-cli] runs-on: ubuntu-latest + continue-on-error: true steps: # Cleanup step to delete old caches - name: Cleanup @@ -291,7 +338,7 @@ jobs: echo "Deleting caches..." for cacheKey in $cacheKeysForPR do - if [ "$cacheKey" != "leveldb-windows-x64" ] && [ "$cacheKey" != "leveldb-windows-arm64" ] + if [ "$cacheKey" != "leveldb-windows-latest-x64" ] && [ "$cacheKey" != "leveldb-windows-latest-arm64" ] then gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm fi From 0037cd93d34336e0e7991a225ba6c6171aa74917 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Sun, 23 Jun 2024 20:42:43 -0400 Subject: [PATCH 8/8] Added steps for `codesign` in `release.yml` --- .github/workflows/release.yml | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6337d033ad..bcfddc1185 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,7 +76,7 @@ jobs: build-neo-cli: needs: [build-leveldb] - name: Build & Publish TarBalls (${{ matrix.runtime }}) + name: ${{ matrix.runtime }} runs-on: ubuntu-latest strategy: matrix: @@ -187,7 +187,7 @@ jobs: uses: actions/cache/save@v4 with: path: ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/* - key: leveldb-${{ matrix.os }}-${{ matrix.arch }} + key: neo-${{ matrix.runtime }} enableCrossOsArchive: true # Create a zip file for Windows distributions @@ -246,6 +246,7 @@ jobs: # Upload checksum files for all distributions - name: Upload Checksum File (all) + if: ${{ startsWith(matrix.runtime, 'osx') == false }} uses: actions/upload-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -274,7 +275,7 @@ jobs: uses: actions/cache@v4 with: path: ${{ env.OUTPUT_PATH }}/osx-${{ matrix.arch }}/* - key: neo-macos-latest-${{ matrix.arch }} + key: neo-osx-${{ matrix.arch }} enableCrossOsArchive: true fail-on-cache-miss: true @@ -282,31 +283,32 @@ jobs: working-directory: ${{ env.OUTPUT_PATH }}/osx-${{ matrix.arch }} run: codesign --force --deep -s - neo-cli + # Create the distribution directory + - name: Create Distribution Directory + run: mkdir -p ${{ env.DIST_PATH }} + # Create a tarball file for macOS distributions - name: Create Tarball File (osx) - if: ${{ startsWith(matrix.runtime, 'osx') }} working-directory: ${{ env.OUTPUT_PATH }}/osx-${{ matrix.arch }} run: tar -cJf ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-osx-${{ matrix.arch }}.tar.xz . # Create checksum files for macOS distributions - name: Create Checksum Files (osx) - if: ${{ startsWith(matrix.runtime, 'osx') }} working-directory: ${{ env.DIST_PATH }} env: FILENAME: neo-cli.v${{ env.APP_VERSION }}-osx-${{ matrix.arch }} run: | - sha256sum ${{ env.FILENAME }}.tar.xz > ${{ env.FILENAME }}.sha256 + shasum -a 256 ${{ env.FILENAME }}.tar.xz > ${{ env.FILENAME }}.sha256 # Upload tarball files for macOS distributions - name: Upload Tarball File (osx) - if: ${{ startsWith(matrix.runtime, 'osx') }} uses: actions/upload-release-asset@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz - asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.tar.xz + asset_path: ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-osx-${{ matrix.arch }}.tar.xz + asset_name: neo-cli.v${{ env.APP_VERSION }}-osx-${{ matrix.arch }}.tar.xz asset_content_type: application/x-gtar # Upload checksum files for all distributions @@ -316,14 +318,13 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.sha256 - asset_name: neo-cli.v${{ env.APP_VERSION }}-${{ matrix.runtime }}.sha256 + asset_path: ${{ env.DIST_PATH }}/neo-cli.v${{ env.APP_VERSION }}-osx-${{ matrix.arch }}.sha256 + asset_name: neo-cli.v${{ env.APP_VERSION }}-osx-${{ matrix.arch }}.sha256 asset_content_type: text/plain cleanup: - needs: [build-neo-cli] + needs: [build-neo-cli, code-sign] runs-on: ubuntu-latest - continue-on-error: true steps: # Cleanup step to delete old caches - name: Cleanup @@ -338,10 +339,7 @@ jobs: echo "Deleting caches..." for cacheKey in $cacheKeysForPR do - if [ "$cacheKey" != "leveldb-windows-latest-x64" ] && [ "$cacheKey" != "leveldb-windows-latest-arm64" ] - then - gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm - fi + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm done echo "Done" env: