From 7858ec9b5b45a70831604673c6ccbdcf29f88539 Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Tue, 6 Aug 2024 16:22:24 +0530 Subject: [PATCH] build.yaml: Use release tag for separation of built artifacts --- .github/workflows/build.yaml | 26 +++++++++++--------------- .github/workflows/release.yaml | 7 +++++-- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f3e606b9ae..271d1b326f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -86,6 +86,7 @@ jobs: echo "GOOS=${{ matrix.target.GOOS }}" >> $GITHUB_ENV echo "GO_BUILD_DIR=lp-builds/" >> $GITHUB_ENV echo "PKG_CONFIG_PATH=/github/home/compiled/lib/pkgconfig" >> $GITHUB_ENV + echo "LP_BUILD_DIR=livepeer-${{ matrix.target.GOOS }}-${{ matrix.target.GOARCH }}" >> $GITHUB_ENV mkdir -p "lp-builds/livepeer-${{ matrix.target.GOOS }}-${{ matrix.target.GOARCH }}" releases/ - name: Set GPU build environment @@ -95,6 +96,7 @@ jobs: echo "LIBRARY_PATH=/usr/local/cuda_${{ matrix.target.GOARCH }}/lib64" >> $GITHUB_ENV echo "CGO_LDFLAGS=-L/usr/local/cuda_${{ matrix.target.GOARCH }}/lib64" >> $GITHUB_ENV echo "RELEASE_TAG=gpu" >> $GITHUB_ENV + echo "LP_BUILD_DIR=livepeer-${{ matrix.target.GOOS }}-gpu-${{ matrix.target.GOARCH }}" >> $GITHUB_ENV - name: Install dependencies run: | @@ -130,20 +132,20 @@ jobs: if: matrix.target.GOOS == 'windows' run: | cd "$GO_BUILD_DIR/" - find . -type f -exec mv '{}' 'livepeer-${GOOS}-${GOARCH}/{}' \; - zip -9rq "../releases/livepeer-${GOOS}-${GOARCH}.zip" ./ + find . -type f -exec mv '{}' "$LP_BUILD_DIR/" \; + zip -9rq "../releases/$LP_BUILD_DIR.zip" ./ - name: Archive binaries if: matrix.platform.name != 'windows' run: | cd "$GO_BUILD_DIR/" - find . -type f -exec mv '{}' 'livepeer-${GOOS}-${GOARCH}/{}' \; - tar -czvf "../releases/livepeer-${GOOS}-${GOARCH}.tar.gz" ./ + find . -type f -exec mv '{}' "$LP_BUILD_DIR" \; + tar -czvf "../releases/$LP_BUILD_DIR.tar.gz" ./ - name: Upload artifacts for cutting release uses: actions/upload-artifact@v4 with: - name: release-artifacts-${{ matrix.target.GOOS }}-${{ matrix.target.GOARCH }} + name: release-artifacts-${{ matrix.target.GOOS }}-${{ matrix.target.type }}-${{ matrix.target.GOARCH }} path: releases/ macos-build: @@ -183,6 +185,8 @@ jobs: echo "GOARCH=${{ matrix.target.GOARCH }}" >> $GITHUB_ENV echo "GOOS=${{ matrix.target.GOOS }}" >> $GITHUB_ENV echo "GO_BUILD_DIR=lp-builds/" >> $GITHUB_ENV + echo "LP_BUILD_DIR=livepeer-${{ matrix.target.GOOS }}-${{ matrix.target.GOARCH }}" >> $GITHUB_ENV + mkdir -p "lp-builds/livepeer-${{ matrix.target.GOOS }}-${{ matrix.target.GOARCH }}" releases/ - name: Cache ffmpeg id: cache-ffmpeg @@ -232,16 +236,8 @@ jobs: if: matrix.platform.name != 'windows' run: | cd "$GO_BUILD_DIR/" - tar -czvf "../releases/livepeer-${GOOS}-${GOARCH}.tar.gz" . - - - name: Upload build - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository - env: - GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }} - GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }} - GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }} - DISCORD_URL: ${{ secrets.DISCORD_URL }} - run: ./upload_build.sh + find . -type f -exec mv '{}' "$LP_BUILD_DIR" \; + tar -czvf "../releases/${LP_BUILD_DIR}.tar.gz" . - name: Upload artifacts for cutting release uses: actions/upload-artifact@v4 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 270c698e61..aa5c29eeb7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,10 +19,13 @@ jobs: ref: ${{ github.event.workflow_run.head_branch }} - name: Download artifacts from build stage - uses: dawidd6/action-download-artifact@v3 + uses: dawidd6/action-download-artifact@v6 with: workflow: build.yaml - name: release-artifacts + workflow_conclusion: success + run_id: ${{ github.event.workflow_run.id }} + name: release-artifacts-.* + name_is_regexp: true path: releases/ - uses: actions-ecosystem/action-regex-match@v2