PaletteSwitcher/.gitea/workflows/ci.yml

129 lines
3.2 KiB
YAML
Raw Normal View History

2021-12-12 18:47:41 +00:00
name: Build and deploy
2021-12-12 18:42:19 +00:00
on:
push:
2024-01-12 18:53:00 +00:00
branches: [master]
2021-12-12 18:42:19 +00:00
jobs:
build-wasm:
runs-on: ubuntu-latest
env:
working_directory: "./src"
steps:
2024-01-12 18:53:00 +00:00
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
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
2021-12-12 18:42:19 +00:00
build-react:
runs-on: ubuntu-latest
env:
working_directory: "./client"
steps:
2024-01-12 18:53:00 +00:00
- uses: actions/checkout@v2
- name: Setup Node.js environment
Update actions/setup-node action to v2.5.2 (#38) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/setup-node](https://github.com/actions/setup-node) | action | patch | `v2.5.0` -> `v2.5.2` | --- ### Release Notes <details> <summary>actions/setup-node (actions/setup-node)</summary> ### [`v2.5.2`](https://github.com/actions/setup-node/releases/tag/v2.5.2): Update @&#8203;actions/core for v2 [Compare Source](https://github.com/actions/setup-node/compare/v2.5.1...v2.5.2) In scope of this release we updated actions/core to 1.10.0 and actions/tool-cache to 1.7.2 for v2: https://github.com/actions/setup-node/pull/713 ### [`v2.5.1`](https://github.com/actions/setup-node/releases/tag/v2.5.1): Fix logic of error handling for npm warning and uncaught exception [Compare Source](https://github.com/actions/setup-node/compare/v2.5.0...v2.5.1) In scope of this release we fix logic of error handling related to caching (https://github.com/actions/setup-node/pull/358) and (https://github.com/actions/setup-node/pull/359). In the previous behaviour we relied on `stderr` output to throw error. The warning messages from package managers can be written to the stderr's output. For now the action will throw an error only if exit code differs from zero. Besides, we add logic to сatch and log unhandled exceptions. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xNDIuNSIsInVwZGF0ZWRJblZlciI6IjM4LjE0Mi41IiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=--> Reviewed-on: https://gitea.bruyant.xyz/alexandre/PaletteSwitcher/pulls/38 Co-authored-by: Renovate <renovate@bruyant.xyz> Co-committed-by: Renovate <renovate@bruyant.xyz>
2024-11-08 12:06:01 +00:00
uses: actions/setup-node@v2.5.2
2024-01-12 18:53:00 +00:00
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
2021-12-12 18:42:19 +00:00
merge:
runs-on: ubuntu-latest
2021-12-12 18:43:25 +00:00
needs: [build-wasm, build-react]
2021-12-12 18:42:19 +00:00
env:
working_directory: "./client"
steps:
- name: Download React app
uses: actions/download-artifact@v4
2021-12-12 18:42:19 +00:00
with:
name: react-app
path: app
2024-01-12 18:53:00 +00:00
2021-12-12 18:42:19 +00:00
- name: Download WASM program
uses: actions/download-artifact@v4
2021-12-12 18:42:19 +00:00
with:
name: wasm
2021-12-12 18:56:16 +00:00
path: app
2024-01-12 18:53:00 +00:00
2021-12-12 18:42:19 +00:00
- name: Upload react app
2024-01-03 12:03:33 +00:00
uses: actions/upload-artifact@v3
2021-12-12 18:42:19 +00:00
with:
name: react-app-wasm
path: app
2024-01-12 18:53:00 +00:00
pin:
name: Pin to cluster node
2024-01-12 18:57:15 +00:00
needs: merge
2021-12-12 18:42:19 +00:00
runs-on: ubuntu-latest
2024-01-12 18:53:00 +00:00
container:
image: catthehacker/ubuntu:act-latest
2021-12-12 18:42:19 +00:00
outputs:
2024-01-12 18:53:00 +00:00
cid: ${{ steps.pin.outputs.cid }}
2021-12-12 18:42:19 +00:00
steps:
- uses: actions/download-artifact@v4
2021-12-12 18:42:19 +00:00
with:
name: react-app-wasm
2024-01-12 18:53:00 +00:00
path: app
- name: pin
id: pin
2024-01-13 07:52:30 +00:00
uses: docker://gitea.bruyant.xyz/alexandre/ipfs-node-pin:1.0.1
2021-12-12 18:42:19 +00:00
with:
2024-01-12 18:53:00 +00:00
ipfs_host: "ipfs-api.ipfs.svc"
ipfs_port: "5001"
path_to_add: app
- name: print CID
run: echo ${{ steps.pin.outputs.cid }}
2021-12-12 18:42:19 +00:00
update-dns:
name: Update OVH DNS
2024-01-12 18:53:00 +00:00
needs: [pin]
2021-12-12 18:42:19 +00:00
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
2024-01-12 18:53:00 +00:00
target: "dnslink=/ipfs/${{ needs.pin.outputs.cid }}"
2021-12-12 18:42:19 +00:00
- 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