wording #108
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Static Website | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: cachix/install-nix-action@v20 | |
with: | |
nix_path: nixpkgs=channel:nixos-23.11 | |
- uses: DeterminateSystems/magic-nix-cache-action@v2 | |
- name: Build Website | |
run: | | |
nix-build | |
- name: Upload to Remote Server | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
rsync -acv --delete --chmod=ugo=rwX -e "ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa" $(readlink result)/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/srv/http/wesl.ee/ | |
- name: Upload and pin to IPFS | |
run: | | |
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF' | |
IPNS=k2k4r8mboahxabdczxp817ktff8blpdo6z32kjw5qjuvlc9c56tjbr9m | |
OLD=$(ipfs name resolve $IPNS) | |
echo Unpinning $OLD | |
ipfs pin rm $OLD | |
NEWHASH=$(ipfs add --cid-version 1 -Qr /srv/http/wesl.ee) | |
ipfs name publish --key=wesl-ee /ipfs/$NEWHASH | |
EOF |