Skip to content

Commit

Permalink
try to use cache from separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
petersalomonsen committed Dec 27, 2024
1 parent 7b34ddd commit 84d3213
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 76 deletions.
77 changes: 1 addition & 76 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -413,79 +413,4 @@ jobs:
yarn install
yarn test-web
buildexamplecontracts:
name: Build example contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Restore Cache
uses: actions/cache@v4
with:
path: |
~/.wasmtime
~/.cargo
bin
node_modules
emsdk
wabt-1.0.35
binaryen-version_116
quickjs-2024-01-13
key: ${{ runner.os }}-dependencies-${{ hashFiles('**/yarn.lock', '.devcontainer/install-dependencies.sh') }}

- name: Set up paths and Rust
run: |
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
echo "$(pwd)/binaryen-version_116/bin" >> $GITHUB_PATH
echo "$(pwd)/wabt-1.0.35/bin" >> $GITHUB_PATH
rustup target add wasm32-wasip1
rustup target add wasm32-unknown-unknown
- name: Build example contracts
run: |
(cd examples/nft && ./build.sh)
(cd examples/minimumweb4 && ./build.sh)
(cd examples/fungibletoken && ./build.sh)
- name: Package WASM files into a ZIP
run: |
mkdir -p release
zip -j release/example_contracts.zip examples/nft/out/nft.wasm examples/minimumweb4/out/minimum_web4.wasm examples/fungibletoken/out/fungible_token.wasm
- name: Upload WASM ZIP artifact
uses: actions/upload-artifact@v3
with:
name: wasm-zip
path: release/example_contracts.zip

release:
name: Create Release
needs: buildexamplecontracts
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download WASM ZIP artifact
uses: actions/download-artifact@v3
with:
name: wasm-zip

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload ZIP file to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./example_contracts.zip
asset_name: example_contracts.zip
asset_content_type: application/zip
87 changes: 87 additions & 0 deletions .github/workflows/release-example-contracts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Release example contracts

on:
push:
tags:
- 'v*.*.*'
pull_request:
branches: [ main ]

jobs:
buildexamplecontracts:
name: Build example contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Restore Cache
uses: actions/cache@v4
with:
path: |
~/.wasmtime
~/.cargo
bin
node_modules
emsdk
wabt-1.0.35
binaryen-version_116
quickjs-2024-01-13
key: ${{ runner.os }}-dependencies-${{ hashFiles('**/yarn.lock', '.devcontainer/install-dependencies.sh') }}

- name: Set up paths and Rust
run: |
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
echo "$(pwd)/binaryen-version_116/bin" >> $GITHUB_PATH
echo "$(pwd)/wabt-1.0.35/bin" >> $GITHUB_PATH
rustup target add wasm32-wasip1
rustup target add wasm32-unknown-unknown
- name: Build example contracts
run: |
(cd examples/nft && ./build.sh)
(cd examples/minimumweb4 && ./build.sh)
(cd examples/fungibletoken && ./build.sh)
- name: Package WASM files into a ZIP
run: |
mkdir -p release
zip -j release/example_contracts.zip examples/nft/out/nft.wasm examples/minimumweb4/out/minimum_web4.wasm examples/fungibletoken/out/fungible_token.wasm
- name: Upload WASM ZIP artifact
uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/tags/')
with:
name: wasm-zip
path: release/example_contracts.zip

release:
name: Create Release
needs: buildexamplecontracts
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download WASM ZIP artifact
uses: actions/download-artifact@v3
with:
name: wasm-zip

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload ZIP file to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./example_contracts.zip
asset_name: example_contracts.zip
asset_content_type: application/zip

0 comments on commit 84d3213

Please sign in to comment.