Skip to content

Commit

Permalink
mandatory --pin= argument for ipfs-add.sh; build job for branches oth…
Browse files Browse the repository at this point in the history
…er than main
  • Loading branch information
SuzanneSoy committed Nov 20, 2023
1 parent 27acbf8 commit f367723
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/github_update_homepage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion .github/pin-using-ipfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/build-website.yml
Original file line number Diff line number Diff line change
@@ -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)"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down

0 comments on commit f367723

Please sign in to comment.