Skip to content

Load from blockchain #14478

Load from blockchain

Load from blockchain #14478

# This is a basic workflow to help you get started with Actions
name: Load from blockchain
# Controls when the workflow will run
on:
# Triggers the workflow every hour on the 21st minute
schedule:
- cron: '21 * * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check_for_updates:
name: Check for updates on-chain since last committed to repository
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Check-out tenthousandsu.com website repository
uses: actions/checkout@v3
- name: Check-out update-script repository
uses: actions/checkout@v3
with:
repository: 'su-squares/update-script'
path: 'update-script'
- name: Wire up update-script
env:
UPDATE_SCRIPT_CONFIG_JSON: ${{ secrets.UPDATE_SCRIPT_CONFIG_JSON }}
run: |
mv build update-script/build
mv erc721 update-script/build/metadata
echo $UPDATE_SCRIPT_CONFIG_JSON > update-script/config.json
- name: Set up Node 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
cache-dependency-path: 'update-script/yarn.lock'
- name: Install package dependencies with yarn
run: |
cd update-script
yarn install --immutable
- name: Run have-there-been-updates.mjs
timeout-minutes: 5
run: |
cd update-script
node have-there-been-updates.mjs || echo "LOAD=yes" >> $GITHUB_ENV
- name: Run load-blockchain.mjs
if: env.LOAD == 'yes'
timeout-minutes: 5
run: |
cd update-script
node load-blockchain.mjs
- name: Export build from update-script
if: env.LOAD == 'yes'
run: |
mv update-script/build/metadata erc721
mv update-script/build build
- name: Commit back to this repository
if: env.LOAD == 'yes'
run: |
git add build erc721
git config user.name "update-script/load-blockchain.mjs"
git config user.email "<>"
git commit -m 'Load from blockchain'
#git push -u origin main:workflow-test
git push