2024-10-20 00:45:46 -05:00
|
|
|
name: Build and Deploy docker container
|
2025-01-25 12:09:18 -06:00
|
|
|
|
2025-01-25 12:16:06 -06:00
|
|
|
on: [push]
|
2025-01-25 12:09:18 -06:00
|
|
|
|
2024-10-17 13:23:20 -05:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-11-15 14:52:06 -06:00
|
|
|
- name: Checkout main
|
|
|
|
uses: actions/checkout@v4
|
2024-11-02 23:49:20 -05:00
|
|
|
- name: Install Yarn
|
|
|
|
run: npm install -g yarn
|
|
|
|
- name: Set Node.js 22.x
|
|
|
|
uses: actions/setup-node@v4
|
|
|
|
with:
|
|
|
|
node-version: 22.x
|
2024-11-04 23:18:28 -06:00
|
|
|
cache: yarn
|
2024-11-02 23:49:20 -05:00
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
2024-11-02 23:50:29 -05:00
|
|
|
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
2024-11-15 14:52:06 -06:00
|
|
|
- name: Restore cache
|
|
|
|
uses: actions/cache@v4
|
2024-11-04 23:18:28 -06:00
|
|
|
id: yarn-cache
|
2024-11-02 23:49:20 -05:00
|
|
|
with:
|
2024-11-02 23:55:42 -05:00
|
|
|
path: |
|
|
|
|
${{ steps.yarn-cache-dir-path.outputs.dir }}
|
2024-11-19 14:50:18 -06:00
|
|
|
${{ github.workspace }}/.next/
|
2024-11-20 23:20:04 -06:00
|
|
|
node_modules/
|
|
|
|
${{ github.workspace }}/out/
|
2024-11-04 23:18:28 -06:00
|
|
|
key: '${{ runner.os }}-yarn-${{ hashFiles(''**/yarn.lock'') }}'
|
2024-11-02 23:49:20 -05:00
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
2024-11-15 14:52:06 -06:00
|
|
|
- name: Update node modules
|
2024-11-15 22:48:01 -06:00
|
|
|
run: yarn install --immutable
|
2024-11-15 17:24:47 -06:00
|
|
|
- name: Lint
|
|
|
|
run: yarn lint
|
2024-11-15 14:52:06 -06:00
|
|
|
- name: Build app and export to ./out
|
2024-11-19 14:57:11 -06:00
|
|
|
run: EXPORT=1 UNOPTIMIZED=1 yarn build
|
2024-11-04 23:18:28 -06:00
|
|
|
- name: Set up Docker Buildx
|
2024-11-02 23:49:20 -05:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2024-11-04 23:18:28 -06:00
|
|
|
- name: Login to Docker Hub
|
2024-11-02 23:49:20 -05:00
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: git.jonb.io
|
2024-11-04 23:18:28 -06:00
|
|
|
username: '${{ gitea.actor }}'
|
|
|
|
password: '${{ secrets.JONBIO_CI }}'
|
|
|
|
- name: Build and push
|
2024-11-02 23:49:20 -05:00
|
|
|
uses: docker/build-push-action@v6
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
2024-11-04 23:18:28 -06:00
|
|
|
tags: 'git.jonb.io/jblu/jonbio:latest'
|
|
|
|
cache-from: 'type=registry,ref=git.jonb.io/jblu/jonbio:buildcache'
|
|
|
|
cache-to: >-
|
|
|
|
type=registry,image-manifest=true,oci-mediatypes=true,ref=git.jonb.io/jblu/jonbio:buildcache,mode=max
|
2024-11-15 22:48:01 -06:00
|
|
|
- name: Deploy app
|
2024-11-02 23:49:20 -05:00
|
|
|
uses: fjogeleit/http-request-action@v1
|
|
|
|
with:
|
2025-01-25 12:00:29 -06:00
|
|
|
url: 'http://10.5.0.11:7777/v1/update'
|
2024-11-04 23:18:28 -06:00
|
|
|
method: GET
|
|
|
|
bearerToken: '${{ secrets.DEPLOYTOKEN }}'
|
2024-11-26 01:02:24 -06:00
|
|
|
timeout: 60000
|