-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
142 additions
and
79 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
name: Build apps and Docker image | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
front: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
cache-dependency-path: front/package-lock.json | ||
|
||
- run: npm ci | ||
working-directory: front | ||
|
||
# - run: npm test | ||
# working-directory: front | ||
|
||
- run: npm run build | ||
working-directory: front | ||
|
||
- name: upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: front | ||
path: front/build | ||
|
||
back: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
cache-dependency-path: back/package-lock.json | ||
|
||
- run: npm ci | ||
working-directory: back | ||
|
||
# - run: npm test | ||
# working-directory: back | ||
|
||
- run: npm run build | ||
working-directory: back | ||
|
||
- name: upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: back | ||
path: back/dist | ||
|
||
- name: Restore back deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: back/node_modules | ||
key: back/package-lock.json | ||
|
||
docker: | ||
runs-on: ubuntu-latest | ||
|
||
needs: [front, back] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: datatok/gui | ||
|
||
steps: | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Download front artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: front | ||
path: front/build | ||
|
||
- name: Download back artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: back | ||
path: back/dist | ||
|
||
- name: Restore back deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: back/node_modules | ||
key: back/package-lock.json | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: packages/docker/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: | | ||
BUILDKIT_INLINE_CACHE=1 |