Skip to content

Commit

Permalink
build.yaml: Use release tag for separation of built artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
hjpotter92 committed Aug 6, 2024
1 parent a0909df commit 7858ec9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7858ec9

Please sign in to comment.