chore: libraries update #38
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: push to swarm | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: . | |
strategy: | |
matrix: | |
node-version: [17.x] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Set environment specific variables | |
uses: jnus/[email protected] | |
with: | |
scope: ${{ github.ref_name }} | |
configFile: '.github/workflows/variables.json' | |
secrets: '${{ toJson(secrets.github_token) }}' | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | |
name: List the state of node modules | |
continue-on-error: true | |
run: npm list | |
- name: install | |
run: npm install | |
- name: copy vars to .env | |
run: | | |
env | grep 'VITE' > .env | |
- name: build | |
run: npm run build | |
env: | |
CI: false | |
- name: Upload | |
id: swarm-upload | |
uses: ethersphere/swarm-actions/upload-dir@latest | |
with: | |
bee-url: ${{ env.SWARM_URL }} | |
dir: ./dist | |
index-document: index.html | |
timeout: 200000 | |
- name: update feed | |
id: swarm-feed | |
env: | |
SIGNER: SIGNER_${{ github.ref_name}} | |
uses: ethersphere/swarm-actions/write-feed@latest | |
with: | |
bee-url: ${{ env.SWARM_URL }} | |
reference: ${{ steps.swarm-upload.outputs.reference }} | |
topic: consents | |
signer: ${{ secrets[env.SIGNER] }} | |
- name: get CID | |
id: swarm-cid | |
uses: ethersphere/swarm-actions/reference-to-cid@latest | |
with: | |
reference: ${{ steps.swarm-feed.outputs.reference }} | |
- name: print | |
run: | | |
echo "upload ref: " ${{ steps.swarm-upload.outputs.reference }} | |
echo "feed ref: " ${{ steps.swarm-feed.outputs.reference }} | |
echo "CID: " ${{ steps.swarm-cid.outputs.cid }} | |
echo 'Feed Manifest: ${{ steps.swarm-feed.outputs.manifest }}' | |
- name: purge cache | |
env: | |
TOKEN: "${{ secrets.purge_token }}" | |
run: | | |
curl -s ${{ env.PURGE_URL }}/deploy/purge?token=${{ secrets.purge_token }} -H "site: fairdrive${{ env.DEPLOYMENT }}fairdatasociety.org" -H "uri: apps/fportal/" |