Skip to content

Commit 6a20e39

Browse files
committed
Update workflow to use custom release
1 parent 1d5726a commit 6a20e39

File tree

1 file changed

+17
-48
lines changed

1 file changed

+17
-48
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- master
8+
- workflow-updates
89
paths: [
910
'.github/workflows/build.yml',
1011
'.github/workflows/build-linux-cross.yml',
@@ -159,31 +160,15 @@ jobs:
159160
- name: Dawn Dependency
160161
id: dawn-depends
161162
run: |
162-
ARTIFACTS_JSON=$(curl -s -L \
163-
-H "Accept: application/vnd.github+json" \
164-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
165-
-H "X-GitHub-Api-Version: 2022-11-28" \
166-
"https://api.github.com/repos/google/dawn/actions/artifacts")
167-
echo "Finding latest macos-latest-Release artifact..."
168-
DOWNLOAD_URL=$(echo "$ARTIFACTS_JSON" | jq -r '.artifacts
169-
| sort_by(.created_at)
170-
| reverse
171-
| map(select(.name | test("macos-latest-Release$")))
172-
| .[0].archive_download_url')
173-
if [ "$DOWNLOAD_URL" = "null" ] || [ -z "$DOWNLOAD_URL" ]; then
174-
echo "No suitable Dawn artifact found!"
175-
exit 1
176-
fi
177-
echo "Downloading from: $DOWNLOAD_URL"
178-
curl -L \
179-
-H "Accept: application/vnd.github+json" \
180-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
181-
-o artifact.zip "$DOWNLOAD_URL"
182-
unzip artifact.zip
163+
DAWN_VERSION="v1.0.0"
164+
DAWN_OWNER="reeselevine"
165+
DAWN_REPO="dawn"
166+
DAWN_ASSET_NAME="Dawn-a1a6b45cced25a3b7f4fb491e0ae70796cc7f22b-macos-latest-Release.tar.gz"
167+
echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
168+
curl -L -o artifact.tar.gz \
169+
"https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
183170
mkdir dawn
184-
tar_file=$(find . -name '*.tar.gz' | head -n 1)
185-
echo "Extracting: $tar_file"
186-
tar -xvf "$tar_file" -C dawn --strip-components=1
171+
tar -xvf artifact.tar.gz -C dawn --strip-components=1
187172
188173
- name: Build
189174
id: cmake_build
@@ -433,31 +418,15 @@ jobs:
433418
id: dawn-depends
434419
run: |
435420
sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev libxi-dev
436-
ARTIFACTS_JSON=$(curl -s -L \
437-
-H "Accept: application/vnd.github+json" \
438-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
439-
-H "X-GitHub-Api-Version: 2022-11-28" \
440-
"https://api.github.com/repos/google/dawn/actions/artifacts")
441-
echo "Finding latest ubuntu-latest-Release artifact..."
442-
DOWNLOAD_URL=$(echo "$ARTIFACTS_JSON" | jq -r '.artifacts
443-
| sort_by(.created_at)
444-
| reverse
445-
| map(select(.name | test("ubuntu-latest-Release$")))
446-
| .[0].archive_download_url')
447-
if [ "$DOWNLOAD_URL" = "null" ] || [ -z "$DOWNLOAD_URL" ]; then
448-
echo "No suitable Dawn artifact found!"
449-
exit 1
450-
fi
451-
echo "Downloading from: $DOWNLOAD_URL"
452-
curl -L \
453-
-H "Accept: application/vnd.github+json" \
454-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
455-
-o artifact.zip "$DOWNLOAD_URL"
456-
unzip artifact.zip
421+
DAWN_VERSION="v1.0.0"
422+
DAWN_OWNER="reeselevine"
423+
DAWN_REPO="dawn"
424+
DAWN_ASSET_NAME="Dawn-a1a6b45cced25a3b7f4fb491e0ae70796cc7f22b-ubuntu-latest-Release.tar.gz"
425+
echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
426+
curl -L -o artifact.tar.gz \
427+
"https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
457428
mkdir dawn
458-
tar_file=$(find . -name '*.tar.gz' | head -n 1)
459-
echo "Extracting: $tar_file"
460-
tar -xvf "$tar_file" -C dawn --strip-components=1
429+
tar -xvf artifact.tar.gz -C dawn --strip-components=1
461430
462431
- name: Build
463432
id: cmake_build

0 commit comments

Comments
 (0)