Skip to content

Commit

Permalink
feat: add to IPFS on PR (#976)
Browse files Browse the repository at this point in the history
* feat: add to IPFS on PR

- Adds work flow to add the rendered website to IPFS, whenever a commit is pushed. Adds a github status on the commit with a link to the rendered site.
- Replaces hardcoded paths with the $GITHUB_WORKSPACE var. This makes the build work on forked repos, where the repo has to be renamed, and shields us from future issues if actions change their workspace dir.
- Updated IPFS github action to pin to work with the new style github actions https://github.com/ipfs-shipyard/ipfs-github-action


License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
  • Loading branch information
olizilla authored Jul 14, 2020
1 parent 5410142 commit 0a17da1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/add-to-ipfs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Add to IPFS

on: [push]

jobs:
add-to-ipfs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Install Go
run: |
sudo apt-get remove golang-go
sudo apt-get remove --auto-remove golang-go
sudo rm -rf /usr/local/go
sudo rm -rf /usr/local/go1.12
sudo rm -rf /usr/local/go1.27
sudo apt-get update
wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz
sudo tar -xvf go1.14.4.linux-amd64.tar.gz
sudo chown -R root:root ./go
sudo cp -r go /usr/local
sudo cp -r go /usr/local/go1.12
sudo cp -r go /usr/local/go1.27
sudo ln -sf /usr/local/go/bin/go /usr/bin/go
sudo echo 'GOROOT=/usr/local/go' >> ~/.profile
sudo echo 'GOPATH=$HOME/work' >>~/.profile
sudo echo 'PATH=$GOROOT/bin:$GOPATH/bin' >>~/.profile
source ~/.profile
- name: Install deps-ga
run: |
sudo make deps-ga
- name: Build
run: |
sudo chown -R root:root $GITHUB_WORKSPACE
sudo make build
- uses: ipfs-shipyard/ipfs-github-action@v1.0.0
with:
path_to_add: $GITHUB_WORKSPACE/build/website
cluster_host: /dnsaddr/cluster.ipfs.io
cluster_user: ${{ secrets.CLUSTER_USER }}
cluster_password: ${{ secrets.CLUSTER_PASSWORD }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ jobs:
- name: Build
run: |
sudo chown -R root:root /home/runner/work/specs
sudo chown -R root:root $GITHUB_WORKSPACE
sudo make build
- name: Deploy using SSH
env:
DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sudo chown -R runner /home/runner/work/specs/specs
sudo chown -R runner $GITHUB_WORKSPACE
sudo chown -R runner .git/
eval "$(ssh-agent -s)"
ssh-add - <<< "${DEPLOY_KEY}"
Expand Down

0 comments on commit 0a17da1

Please sign in to comment.