Merge pull request #369 from hyperware-ai/develop #57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy kit Create Release | |
| on: | |
| # Runs on pushes targeting prod or dev branches | |
| push: | |
| branches: ["master", "v*"] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| build_and_test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Set up nvm, node, npm p0 | |
| run: | | |
| echo "$HOME" >> $GITHUB_PATH | |
| echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV | |
| - name: Set up nvm, node, npm p1 | |
| run: | | |
| source $NVM_DIR/nvm.sh | |
| nvm install 20.0.0 | |
| nvm --version | |
| - name: Set up cargo | |
| run: | | |
| curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh | |
| rustup update | |
| cargo install wasm-tools | |
| rustup target add wasm32-wasip1 | |
| cargo install cargo-wasi | |
| - name: Get latest release from foundry-rs/foundry | |
| id: get-latest-foundry-release | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const repo = { | |
| owner: 'foundry-rs', | |
| repo: 'foundry', | |
| per_page: 1, | |
| page: 1, | |
| }; | |
| const releases = await github.rest.repos.listReleases(repo); | |
| const preReleases = releases.data.filter(release => release.prerelease); | |
| // Sort pre-releases by created_at date in descending order | |
| preReleases.sort((a, b) => new Date(b.created_at) - new Date(a.created_at)); | |
| if (preReleases.length === 0) { | |
| throw new Error('No pre-releases found'); | |
| } | |
| const latestPreRelease = preReleases[0]; | |
| const asset = latestPreRelease.assets.find(asset => asset.name.match(/foundry_nightly_linux_amd64\.tar\.gz/)); | |
| if (!asset) { | |
| throw new Error('Asset not found'); | |
| } | |
| return asset.browser_download_url; | |
| result-encoding: string | |
| - name: Build the release | |
| run: ./scripts/build-release.py | |
| - name: Unzip the build output | |
| run: unzip /tmp/kit-release/kit-x86_64-unknown-linux-gnu.zip | |
| - name: Run tests | |
| run: | | |
| { ./kit t src/new/templates/tests.toml; } 2>&1 |