From 83884e68bd38f20b3d415606719319c6bd04d787 Mon Sep 17 00:00:00 2001 From: Nate Maninger Date: Tue, 7 May 2024 10:55:33 -0700 Subject: [PATCH] ci: fix duplicate artifact names --- .github/workflows/publish.yml | 58 ++++++---------------- .github/workflows/publish_testnet.yml | 70 +++++++++------------------ 2 files changed, 38 insertions(+), 90 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0917d88c..fea7c845 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -58,6 +58,9 @@ jobs: build-linux: runs-on: ubuntu-latest needs: [ test ] + strategy: + matrix: + go-arch: [amd64, arm64] steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 @@ -68,36 +71,27 @@ jobs: sudo apt update sudo apt install -y gcc-aarch64-linux-gnu go generate ./... - - name: Build amd64 + - name: Build ${{ matrix.go-arch }} env: CGO_ENABLED: 1 GOOS: linux - GOARCH: amd64 + GOARCH: ${{ matrix.go-arch }} run: | mkdir -p release ZIP_OUTPUT=release/hostd_${GOOS}_${GOARCH}.zip go build -tags='netgo' -trimpath -o bin/ -a -ldflags '-s -w -linkmode external -extldflags "-static"' ./cmd/hostd cp README.md LICENSE bin/ zip -qj $ZIP_OUTPUT bin/* - - name: Build arm64 - env: - CGO_ENABLED: 1 - GOOS: linux - GOARCH: arm64 - CC: aarch64-linux-gnu-gcc - run: | - mkdir -p release - ZIP_OUTPUT=release/hostd_${GOOS}_${GOARCH}.zip - go build -tags='netgo' -trimpath -o bin/ -a -ldflags '-s -w' ./cmd/hostd - cp README.md LICENSE bin/ - zip -qj $ZIP_OUTPUT bin/* - uses: actions/upload-artifact@v4 with: - name: hostd - path: release/ + name: hostd-linux-${{ matrix.go-arch }} + path: release/* build-mac: runs-on: macos-latest needs: [ test ] + strategy: + matrix: + go-arch: [amd64, arm64] steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 @@ -139,27 +133,7 @@ jobs: # resync system clock https://github.com/actions/runner/issues/2996#issuecomment-1833103110 sudo sntp -sS time.windows.com - - name: Build amd64 - env: - APPLE_CERT_ID: ${{ secrets.APPLE_CERT_ID }} - APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} - APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} - APPLE_KEY_B64: ${{ secrets.APPLE_KEY_B64 }} - APPLE_CERT_B64: ${{ secrets.APPLE_CERT_B64 }} - APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }} - APPLE_KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }} - CGO_ENABLED: 1 - GOOS: darwin - GOARCH: amd64 - run: | - ZIP_OUTPUT=release/hostd_${GOOS}_${GOARCH}.zip - mkdir -p release - go build -tags='netgo' -trimpath -o bin/ -a -ldflags '-s -w' ./cmd/hostd - cp README.md LICENSE bin/ - /usr/bin/codesign --deep -f -v --timestamp -o runtime,library -s $APPLE_CERT_ID bin/hostd - ditto -ck bin $ZIP_OUTPUT - xcrun notarytool submit -k ~/private_keys/AuthKey_$APPLE_API_KEY.p8 -d $APPLE_API_KEY -i $APPLE_API_ISSUER --wait --timeout 10m $ZIP_OUTPUT - - name: Build arm64 + - name: Build ${{ matrix.go-arch }} env: APPLE_CERT_ID: ${{ secrets.APPLE_CERT_ID }} APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} @@ -170,7 +144,7 @@ jobs: APPLE_KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }} CGO_ENABLED: 1 GOOS: darwin - GOARCH: arm64 + GOARCH: ${{ matrix.go-arch }} run: | ZIP_OUTPUT=release/hostd_${GOOS}_${GOARCH}.zip mkdir -p release @@ -181,8 +155,8 @@ jobs: xcrun notarytool submit -k ~/private_keys/AuthKey_$APPLE_API_KEY.p8 -d $APPLE_API_KEY -i $APPLE_API_ISSUER --wait --timeout 10m $ZIP_OUTPUT - uses: actions/upload-artifact@v4 with: - name: hostd - path: release/ + name: hostd-darwin-${{ matrix.go-arch }} + path: release/* build-windows: runs-on: windows-latest needs: [ test ] @@ -211,8 +185,8 @@ jobs: 7z a $ZIP_OUTPUT ./bin/* - uses: actions/upload-artifact@v4 with: - name: hostd - path: release/ + name: hostd-windows-amd64 + path: release/* dispatch-homebrew: # only runs on full releases if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') diff --git a/.github/workflows/publish_testnet.yml b/.github/workflows/publish_testnet.yml index 6fa452e8..03502171 100644 --- a/.github/workflows/publish_testnet.yml +++ b/.github/workflows/publish_testnet.yml @@ -1,12 +1,12 @@ name: Publish - Testnet -# Controls when the action will run. +# Controls when the action will run. on: # Triggers the workflow on new SemVer tags push: branches: - master - tags: + tags: - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-**' @@ -60,6 +60,9 @@ jobs: build-linux: runs-on: ubuntu-latest needs: [ test ] + strategy: + matrix: + go-arch: [amd64, arm64] steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 @@ -70,36 +73,27 @@ jobs: sudo apt update sudo apt install -y gcc-aarch64-linux-gnu go generate ./... - - name: Build amd64 + - name: Build ${{ matrix.go-arch }} env: CGO_ENABLED: 1 GOOS: linux - GOARCH: amd64 + GOARCH: ${{ matrix.go-arch }} run: | mkdir -p release ZIP_OUTPUT=release/hostd_zen_${GOOS}_${GOARCH}.zip go build -tags='testnet netgo' -trimpath -o bin/ -a -ldflags '-s -w -linkmode external -extldflags "-static"' ./cmd/hostd cp README.md LICENSE bin/ zip -qj $ZIP_OUTPUT bin/* - - name: Build arm64 - env: - CGO_ENABLED: 1 - GOOS: linux - GOARCH: arm64 - CC: aarch64-linux-gnu-gcc - run: | - mkdir -p release - ZIP_OUTPUT=release/hostd_zen_${GOOS}_${GOARCH}.zip - GOOS=linux GOARCH=arm64 go build -tags='testnet netgo' -trimpath -o bin/ -a -ldflags '-s -w -linkmode external -extldflags "-static"' ./cmd/hostd - cp README.md LICENSE bin/ - zip -qj $ZIP_OUTPUT bin/* - uses: actions/upload-artifact@v4 with: - name: hostd-zen - path: release/ - build-mac: + name: hostd-zen-linux-${{ matrix.go-arch }} + path: release/* + build-mac: runs-on: macos-latest needs: [ test ] + strategy: + matrix: + go-arch: [amd64, arm64] steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 @@ -135,33 +129,13 @@ jobs: security import $APPLE_CERT_PATH -P $APPLE_CERT_PASSWORD -A -t cert -f pkcs12 -k $KEYCHAIN_PATH security find-identity -v $KEYCHAIN_PATH -p codesigning security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $APPLE_KEYCHAIN_PASSWORD $KEYCHAIN_PATH - + # generate go generate ./... - + # resync system clock https://github.com/actions/runner/issues/2996#issuecomment-1833103110 sudo sntp -sS time.windows.com - - name: Build amd64 - env: - APPLE_CERT_ID: ${{ secrets.APPLE_CERT_ID }} - APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} - APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} - APPLE_KEY_B64: ${{ secrets.APPLE_KEY_B64 }} - APPLE_CERT_B64: ${{ secrets.APPLE_CERT_B64 }} - APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }} - APPLE_KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }} - CGO_ENABLED: 1 - GOOS: darwin - GOARCH: amd64 - run: | - ZIP_OUTPUT=release/hostd_zen_${GOOS}_${GOARCH}.zip - mkdir -p release - go build -tags='testnet netgo' -trimpath -o bin/ -a -ldflags '-s -w' ./cmd/hostd - cp README.md LICENSE bin/ - /usr/bin/codesign --deep -f -v --timestamp -o runtime,library -s $APPLE_CERT_ID bin/hostd - ditto -ck bin $ZIP_OUTPUT - xcrun notarytool submit -k ~/private_keys/AuthKey_$APPLE_API_KEY.p8 -d $APPLE_API_KEY -i $APPLE_API_ISSUER --wait --timeout 10m $ZIP_OUTPUT - - name: Build arm64 + - name: Build ${{ matrix.go-arch }} env: APPLE_CERT_ID: ${{ secrets.APPLE_CERT_ID }} APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} @@ -172,7 +146,7 @@ jobs: APPLE_KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }} CGO_ENABLED: 1 GOOS: darwin - GOARCH: arm64 + GOARCH: ${{ matrix.go-arch }} run: | ZIP_OUTPUT=release/hostd_zen_${GOOS}_${GOARCH}.zip mkdir -p release @@ -183,9 +157,9 @@ jobs: xcrun notarytool submit -k ~/private_keys/AuthKey_$APPLE_API_KEY.p8 -d $APPLE_API_KEY -i $APPLE_API_ISSUER --wait --timeout 10m $ZIP_OUTPUT - uses: actions/upload-artifact@v4 with: - name: hostd-zen - path: release/ - build-windows: + name: hostd-zen-darwin-${{ matrix.go-arch }} + path: release/* + build-windows: runs-on: windows-latest needs: [ test ] steps: @@ -213,5 +187,5 @@ jobs: 7z a $ZIP_OUTPUT ./bin/* - uses: actions/upload-artifact@v4 with: - name: hostd-zen - path: release/ \ No newline at end of file + name: hostd-zen-windows-amd64 + path: release/* \ No newline at end of file