Skip to content

Commit

Permalink
build docker image and update gh pages only on final releases, add ip…
Browse files Browse the repository at this point in the history
…fs deployment script
  • Loading branch information
riccardobl committed Jan 5, 2024
1 parent 72108ca commit 2e9eefc
Showing 1 changed file with 39 additions and 6 deletions.
45 changes: 39 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ permissions:
jobs:
# deploy docker to github registry
deployDocker:
if: github.event_name == 'release'
if: github.event_name == 'release' && !github.event.release.prerelease
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
Expand Down Expand Up @@ -50,8 +50,7 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# deploy static
deployStatic:
deployPackage:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -125,9 +124,7 @@ jobs:
--data-binary @"$filename" \
"$url"
# deploy gh pages
deployPages:
if: github.event_name == 'release'
deployWWW:
concurrency: ci-${{ github.ref }}
environment:
name: github-pages
Expand All @@ -138,17 +135,53 @@ jobs:
uses: actions/checkout@v4

- name: Setup Pages
if: github.event_name == 'release' && !github.event.release.prerelease
uses: actions/configure-pages@v4

- name: Build
run: |
bash build.sh
- name: Upload artifact
if: github.event_name == 'release' && !github.event.release.prerelease
uses: actions/upload-pages-artifact@v3
with:
path: "./dist/"

- name: Deploy to GitHub Pages
id: deployment
if: github.event_name == 'release' && !github.event.release.prerelease
uses: actions/deploy-pages@v4

- name: Prepare Node 18
uses: actions/setup-node@v2
with:
node-version: 18

- name: Upload to ipfs
run: |
npm install -g @web3-storage/w3cli
mkdir -p /home/runner/.config/w3access
echo '${{secrets.W3_ACCESS}}' > ~/.config/w3access/w3cli.json
w3 space use anser
w3 up ./dist/ --json > ipfs.json
cid=$(jq -r '.root["/"]' ipfs.json)
echo "$cid" > deploy.log
- name: Write ipfs link to release description
if: false
run: |
set -e
echo "${GITHUB_EVENT_PATH}"
cat ${GITHUB_EVENT_PATH}
releaseId=$(jq --raw-output '.release.id' ${GITHUB_EVENT_PATH})
deployLink=`cat deploy.log`
echo $deployLink
# Add to release description
curl -X PATCH \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/$releaseId \
-d "{\"body\": \"${deployLink}\"}"

0 comments on commit 2e9eefc

Please sign in to comment.