diff --git a/.github/github_update_homepage.sh b/.github/github_update_homepage.sh index c42c320..2f40b05 100755 --- a/.github/github_update_homepage.sh +++ b/.github/github_update_homepage.sh @@ -4,7 +4,7 @@ set -euET -o pipefail echo "Hashing repository contents with IPFS..." -h="$(result/www/ipfs-add.sh)" +h="$(result/www/ipfs-add.sh --pin=true)" printf "The new homepage URL will be: https://%s.ipfs.dweb.link/\n" "$h" diff --git a/.github/pin-using-ipfs.sh b/.github/pin-using-ipfs.sh index 1b37c51..41c0496 100755 --- a/.github/pin-using-ipfs.sh +++ b/.github/pin-using-ipfs.sh @@ -4,7 +4,7 @@ set -euET -o pipefail echo "Hashing repository contents with IPFS..." -h="$(result/www/ipfs-add.sh)" +h="$(result/www/ipfs-add.sh --pin=true)" printf "Pinning ipfs://%s/\n" "$h" diff --git a/.github/workflows/build-website.yml b/.github/workflows/build-website.yml new file mode 100644 index 0000000..a587821 --- /dev/null +++ b/.github/workflows/build-website.yml @@ -0,0 +1,35 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Update repo's Homepage field to the latest IPFS CID + +on: + # Runs on pushes targeting the default branch + push: + branches: ["!main"] + pull_request: + branches: ["!main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# when there are subsequent pushes on the same branch, cancel existing jobs and run the new job instead. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + # Single deploy job since we're just building + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: 'recursive' + - name: Install Nix + uses: cachix/install-nix-action@v17 + - name: Build website + run: nix build + - name: Download IPFS + run: ./.github/github_install_ipfs.sh + - name: Compare IPFS hashes + run: test "ipfs://$(./result/www/ipfs-add.sh --pin=false)" = "$(cat result/ipfs.url)" diff --git a/README.md b/README.md index 3778b7d..0ac6b95 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Build && serve git add . - nix build && result/www/ipfs-add.sh + nix build && result/www/ipfs-add.sh --pin=true Congratulations, the website is already deployed and served by your local IPFS node, and therefore accessible worldwide. To view it: diff --git a/flake.nix b/flake.nix index 1fa4144..e3177f1 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { description = "Bounty website for LIGO"; - inputs.archivable.url = github:SuzanneSoy/archivable/9d01ce1a663bb3cde8e86ea0819dd24721a17bda; + inputs.archivable.url = github:SuzanneSoy/archivable/ac1b3c0c4c40352531a1b2df5201bed33606dc0d; # branch: main @ Mon Nov 20 18:28:22 2023 outputs = { self, nixpkgs, archivable }: { defaultPackage.x86_64-linux = self.packages.x86_64-linux.website; packages.x86_64-linux.website =