From 2a165a4f88ec89b3edcd98ff50cc002063a90439 Mon Sep 17 00:00:00 2001 From: rhodey Date: Wed, 10 Sep 2025 16:17:30 -0400 Subject: [PATCH 1/4] update github action and change a bit of code to serve as better example and publish v4 --- .github/workflows/run.yml | 33 +++++++++++++-------------------- README.md | 2 ++ src/App.jsx | 9 ++------- versions.json | 8 +++++++- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml index b716a86..0c6c81d 100644 --- a/.github/workflows/run.yml +++ b/.github/workflows/run.yml @@ -1,38 +1,31 @@ -name: Run build +name: Run on: push: branches: - master + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + branches: + - master jobs: build: runs-on: ubuntu-24.04 - outputs: - cidv0: ${{ steps.webapp.outputs.cidv0 }} - cidv1: ${{ steps.webapp.outputs.cidv1 }} steps: - uses: actions/checkout@v4 - - name: Build docker - run: docker buildx build --platform=linux/amd64 -t ipfs-boot-react . - - - name: Build webapp - id: webapp + - name: Build run: | + docker buildx build --platform=linux/amd64 -t ipfs-boot-react . docker run --rm -i --platform=linux/amd64 -v ./dist:/root/dist ipfs-boot-react | tee out.txt - cidv0=$(cat out.txt | grep CIDv0 | awk '{print $3}') - cidv1=$(cat out.txt | grep CIDv1 | awk '{print $3}') - echo "cidv0=$cidv0" >> $GITHUB_OUTPUT - echo "cidv1=$cidv1" >> $GITHUB_OUTPUT - - name: Summary + - name: Check CIDs run: | - echo "Build ok" - echo "CIDv0 = ${{ steps.webapp.outputs.cidv0 }}" - echo "CIDv1 = ${{ steps.webapp.outputs.cidv1 }}" - echo "Build ok:" >> $GITHUB_STEP_SUMMARY - echo "+ CIDv0 = ${{ steps.webapp.outputs.cidv0 }}" >> $GITHUB_STEP_SUMMARY - echo "+ CIDv1 = ${{ steps.webapp.outputs.cidv1 }}" >> $GITHUB_STEP_SUMMARY + cidv1_1=$(cat out.txt | grep "CIDv1 =" | awk '{print $3}') + cidv1_2=$(cat README.md | grep "CIDv1 =" | awk '{print $4}') + cidv1_3=$(cat versions.json | jq -r .arr[-1].cid) + bash -c '[[ "$1" == "$2" ]]' _ "$cidv1_1" "$cidv1_2" || exit 1 + bash -c '[[ "$1" == "$2" ]]' _ "$cidv1_1" "$cidv1_3" || exit 1 - name: Zip uses: actions/upload-artifact@v4 diff --git a/README.md b/README.md index 2aca752..ae9693e 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ The aim is reproducible builds so docker is involved ``` docker buildx build --platform=linux/amd64 -t ipfs-boot-react . docker run --rm -i --platform=linux/amd64 -v ./dist:/root/dist ipfs-boot-react +> CIDv0 = QmfSBsx4DW4sNc9S6an9ujiyv3fBHK2fYTG1rzw5ScScCf +> CIDv1 = bafybeih6ahjvidh6r7se5asm2zf53kkpqrhj5phw2mfcx7jdz4uoozj5ja ``` ## Pin diff --git a/src/App.jsx b/src/App.jsx index 98ed11d..589fd5d 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -7,11 +7,6 @@ import './App.css' function App() { const [count, setCount] = useState(0) - // this is only for demonstration - let version = 3 - const duck = version === 1 ? '' : (

Duck

) - version = `v${version}` - return ( <>
@@ -22,8 +17,8 @@ function App() { React logo
-

Vite + React ({version})

- {duck} +

Vite + React (v4)

+

Duck