PaletteSwitcher/.gitea/workflows/ci.yml
Renovate bc6f87139c
All checks were successful
PR build / build-wasm (pull_request) Successful in 12s
PR build / build-react (pull_request) Successful in 42s
PR build / merge (pull_request) Successful in 6s
Build and deploy / build-wasm (push) Successful in 10s
Build and deploy / build-react (push) Successful in 40s
Build and deploy / merge (push) Successful in 9s
Build and deploy / Pin to cluster node (push) Successful in 3s
Build and deploy / Update OVH DNS (push) Successful in 4s
Update gitea.bruyant.xyz/alexandre/ipfs-node-pin Docker tag to v1.0.2
2024-11-09 16:05:03 +00:00

129 lines
3.2 KiB
YAML

name: Build and deploy
on:
push:
branches: [master]
jobs:
build-wasm:
runs-on: ubuntu-latest
env:
working_directory: "./src"
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Build
run: go build -v -o main.wasm ./...
working-directory: ${{env.working_directory}}
env:
GOOS: js
GOARCH: wasm
- name: Upload wasm file
uses: actions/upload-artifact@v3
with:
name: wasm
path: ${{env.working_directory}}/main.wasm
build-react:
runs-on: ubuntu-latest
env:
working_directory: "./client"
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v4.1.0
with:
node-version-file: .nvmrc
- name: NPM CI
working-directory: ${{env.working_directory}}
run: npm ci
- name: React build
working-directory: ${{env.working_directory}}
run: npm run build
- name: Upload react client
uses: actions/upload-artifact@v3
with:
name: react-app
path: ${{env.working_directory}}/build
merge:
runs-on: ubuntu-latest
needs: [build-wasm, build-react]
env:
working_directory: "./client"
steps:
- name: Download React app
uses: actions/download-artifact@v3
with:
name: react-app
path: app
- name: Download WASM program
uses: actions/download-artifact@v3
with:
name: wasm
path: app
- name: Upload react app
uses: actions/upload-artifact@v3
with:
name: react-app-wasm
path: app
pin:
name: Pin to cluster node
needs: merge
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
outputs:
cid: ${{ steps.pin.outputs.cid }}
steps:
- uses: actions/download-artifact@v3
with:
name: react-app-wasm
path: app
- name: pin
id: pin
uses: docker://gitea.bruyant.xyz/alexandre/ipfs-node-pin:1.0.2
with:
ipfs_host: "ipfs-api.ipfs.svc"
ipfs_port: "5001"
path_to_add: app
- name: print CID
run: echo ${{ steps.pin.outputs.cid }}
update-dns:
name: Update OVH DNS
needs: [pin]
runs-on: ubuntu-latest
steps:
- name: OVH alter DNS record
uses: CrispyBaguette/ovh-dns-alter-action@v1.1.1
with:
application-key: ${{ secrets.OVH_APPLICATION_KEY }}
application-secret: ${{ secrets.OVH_APPLICATION_SECRET }}
consumer-key: ${{ secrets.OVH_CONSUMER_KEY }}
dns-zone: bruyant.xyz
record-id: 5218627602
target: "dnslink=/ipfs/${{ needs.pin.outputs.cid }}"
- name: OVH refresh DNS zone
uses: CrispyBaguette/ovh-dns-refresh-action@v1.0.1
with:
application-key: ${{ secrets.OVH_APPLICATION_KEY }}
application-secret: ${{ secrets.OVH_APPLICATION_SECRET }}
consumer-key: ${{ secrets.OVH_CONSUMER_KEY }}
dns-zone: bruyant.xyz