This repository has been archived by the owner on Sep 1, 2023. It is now read-only.
fix(deps): bump all non-major dependencies #285
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: Dev Build | |
on: | |
push: | |
branches-ignore: | |
- 'main' | |
pull_request: | |
branches: | |
- 'dev' | |
jobs: | |
go-test: | |
name: go test | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./backend | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ^1.19 | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: install dep | |
run: | | |
go get -d -v | |
- name: test | |
run: go test -v ./... | |
go: | |
name: go build | |
needs: [ go-test ] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./backend | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ^1.19 | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: install dep | |
run: | | |
go get -d -v | |
- name: build | |
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o . | |
- name: Archive production artifacts | |
if: contains(github.ref, 'dev') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: backend | |
path: backend/e-book-manager | |
yarn: | |
name: cache node modules | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
id: yarn-cache-node-modules | |
with: | |
path: frontend/node_modules | |
key: ${{ runner.os }}-yarn-cache-node-modules-${{ hashFiles('frontend/yarn.lock') }} | |
- name: Yarn install if cache is invalid | |
if: steps.yarn-cache-node-modules.outputs.cache-hit != 'true' | |
working-directory: ./frontend | |
run: yarn install | |
lint: | |
name: lint frontend | |
runs-on: ubuntu-latest | |
needs: [ yarn ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
id: yarn-cache-node-modules | |
with: | |
path: frontend/node_modules | |
key: ${{ runner.os }}-yarn-cache-node-modules-${{ hashFiles('frontend/yarn.lock') }} | |
- name: lint | |
working-directory: ./frontend | |
run: npm run lint | |
build: | |
name: build frontend | |
runs-on: ubuntu-latest | |
needs: [ yarn, lint ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
id: yarn-cache-node-modules | |
with: | |
path: frontend/node_modules | |
key: ${{ runner.os }}-yarn-cache-node-modules-${{ hashFiles('frontend/yarn.lock') }} | |
- name: build vite | |
working-directory: ./frontend | |
run: npm run build | |
- name: Archive production artifacts | |
if: contains(github.ref, 'dev') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: frontend | |
path: frontend/dist | |
docker: | |
name: build docker | |
runs-on: ubuntu-latest | |
needs: [ build, go, lint ] | |
if: contains(github.ref, 'dev') | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
path: ./docker | |
- name: Copy sql | |
run: | | |
cp -R ./backend/sql ./docker/sql | |
- name: Build image | |
working-directory: ./docker | |
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USER }}/e-book-manager | |
- name: push image | |
run: | | |
docker login -u=${{ secrets.DOCKER_USER }} -p=${{ secrets.DOCKER_PASSWORD }} | |
docker tag ${{ secrets.DOCKER_USER }}/e-book-manager ${{ secrets.DOCKER_USER }}/e-book-manager:dev | |
docker push ${{ secrets.DOCKER_USER }}/e-book-manager:dev | |
- uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: | | |
backend | |
frontend |