-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: scheduled&manual workflow to update bin.walrus.site (#91)
- Loading branch information
Showing
3 changed files
with
125 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Set up Walrus and Walrus Sites | ||
description: Install and configure Walrus and build the Walrus Sites site-builder | ||
|
||
inputs: | ||
SUI_ADDRESS: | ||
description: The Sui address to use | ||
required: true | ||
SUI_KEYSTORE: | ||
description: The content of the Sui keystore file | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Create bin directory and add to $PATH | ||
run: | | ||
mkdir -p bin | ||
echo "$(pwd)/bin" >> ${GITHUB_PATH} | ||
shell: bash | ||
- name: Define environment variables | ||
run: | | ||
echo "SUI_CONFIG_DIR=/home/runner/.sui/sui_config" >> $GITHUB_ENV | ||
echo "SUI_KEYSTORE_FILE=/home/runner/.sui/sui_config/sui.keystore" >> $GITHUB_ENV | ||
echo "SUI_CONFIG_FILE=/home/runner/.sui/sui_config/client.yaml" >> $GITHUB_ENV | ||
echo "SUI_ADDRESS=${{ inputs.SUI_ADDRESS }}" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Set up Sui wallet | ||
run: | | ||
mkdir -p $SUI_CONFIG_DIR | ||
CLIENT_CONF="--- | ||
keystore: | ||
File: $SUI_KEYSTORE_FILE | ||
envs: | ||
- alias: testnet | ||
rpc: \"https://fullnode.testnet.sui.io:443\" | ||
active_env: testnet | ||
active_address: \"$SUI_ADDRESS\"" | ||
echo "$CLIENT_CONF" > $SUI_CONFIG_FILE | ||
cat $SUI_CONFIG_FILE | ||
echo '${{ inputs.SUI_KEYSTORE }}' > $SUI_KEYSTORE_FILE | ||
shell: bash | ||
- name: Get SUI from faucet | ||
run: > | ||
curl --location --request POST 'https://faucet.testnet.sui.io/gas' | ||
--header 'Content-Type: application/json' | ||
--data-raw "{ | ||
\"FixedAmountRequest\": { | ||
\"recipient\": \"$SUI_ADDRESS\" | ||
} | ||
}" | ||
shell: bash | ||
|
||
- name: Install and configure Walrus | ||
run: | | ||
# The bin directory was already created and added to $PATH in the build-mdbook action | ||
curl https://storage.googleapis.com/mysten-walrus-binaries/latest/walrus-latest-ubuntu-x86_64 -o bin/walrus | ||
chmod +x bin/walrus | ||
mkdir -p ~/.walrus | ||
curl https://storage.googleapis.com/mysten-walrus-binaries/walrus-configs/client_config.yaml -o ~/.walrus/client_config.yaml | ||
walrus -h # Ensure the walrus binary works | ||
shell: bash | ||
|
||
- name: Clone walrus-sites | ||
run: git clone https://github.com/MystenLabs/walrus-sites | ||
shell: bash | ||
- name: Build site-builder | ||
run: | | ||
cd walrus-sites | ||
cargo build --release | ||
cp target/release/site-builder ../bin | ||
cd - | ||
shell: bash |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Update bin.walrus.site with latest binaries | ||
|
||
on: | ||
# every week | ||
schedule: | ||
- cron: '14 3 * * 0' | ||
# on demand | ||
workflow_dispatch: | ||
|
||
concurrency: ci-${{ github.ref }} | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
# We store the data for the Sui wallet and the site object in GitHub variables | ||
# (https://github.com/MystenLabs/walrus-docs/settings/variables/actions) and secrets | ||
# (https://github.com/MystenLabs/walrus-docs/settings/secrets/actions). | ||
update-bin-walrus-site: | ||
name: Update Walrus Site bin.walrus.site | ||
runs-on: ubuntu-ghcloud | ||
env: | ||
# Colors don't seem to work properly with the multiline commands. | ||
NO_COLOR: 1 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/set-up-walrus | ||
with: | ||
SUI_ADDRESS: "${{ vars.SUI_ADDRESS }}" | ||
SUI_KEYSTORE: "${{ secrets.SUI_KEYSTORE }}" | ||
|
||
- name: Create temporary directory | ||
run: "mkdir -p site" | ||
- name: Download latest binaries | ||
run: | | ||
for arch in ubuntu-x86_64 macos-x86_64 macos-arm64; do | ||
curl https://storage.googleapis.com/mysten-walrus-binaries/latest/walrus-latest-$arch -o site/walrus-$arch | ||
done | ||
- name: Copy site-builder binary | ||
run: "cp bin/site-builder site/site-builder-ubuntu-x86_64" | ||
|
||
- name: Update Walrus Site | ||
run: > | ||
RUST_LOG=site_builder=debug,walrus=debug,info | ||
site-builder | ||
--config walrus-sites/site-builder/assets/builder-example.yaml | ||
update --list-directory site ${{ vars.WALRUS_SITE_BIN_OBJECT }} |