Skip to content

Commit

Permalink
update GH to grab latest HD tag
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaiton committed Apr 26, 2024
1 parent 5a01d81 commit 00c5ee5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/rust_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,28 @@ jobs:
needs: detect-changes
if: needs.detect-changes.outputs.changed == 'true'
steps:
- uses: actions/checkout@v3
- name: Checkout hyperdrive-rs
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}

# NOTE: This is needed to ensure that hyperdrive-wrappers builds correctly.
- name: install foundry
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Fetch latest release tag from Hyperdrive
run: ./scripts/fetch-latest-tag.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: check out hyperdrive
uses: actions/checkout@v4
with:
repository: delvtech/hyperdrive
ref: ${{ env.latest_tag }}
path: "./hyperdrive"

- name: build hyperdrive
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/rust_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ jobs:
needs: detect-changes
if: needs.detect-changes.outputs.changed == 'true'
steps:
- uses: actions/checkout@v3
- name: Checkout hyperdrive-rs
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -30,10 +31,16 @@ jobs:
with:
version: nightly

- name: Fetch latest release tag from Hyperdrive
run: ./scripts/fetch-latest-tag.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: check out hyperdrive
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: delvtech/hyperdrive
ref: ${{ env.latest_tag }}
path: "./hyperdrive"

- name: build hyperdrive
Expand Down
13 changes: 13 additions & 0 deletions scripts/fetch-latest-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# GitHub Token provided by GitHub Actions
TOKEN=${GITHUB_TOKEN}

# Repository from which to fetch the latest tag
REPO='delvtech/hyperdrive'

# Fetch the latest release from GitHub API
TAG=$(curl -sH "Authorization: token $TOKEN" "https://api.github.com/repos/$REPO/releases/latest" | jq -r '.tag_name')

# Output the tag for subsequent steps
echo "latest_tag=$TAG" >> $GITHUB_ENV

0 comments on commit 00c5ee5

Please sign in to comment.