This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
CICD for Frontend Development #81
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: CICD for Frontend Development | |
on: | |
push: | |
branches: | |
- develop | |
paths: | |
- 'frontend/**' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
cache: 'yarn' | |
cache-dependency-path: ${{ vars.FE_DIRECTORY }}/yarn.lock | |
- name: Install dependencies | |
run: | | |
yarn install --frozen-lockfile | |
working-directory: ${{ vars.FE_DIRECTORY }} | |
- name: Create .env.development variable | |
run: | | |
touch .env.development | |
echo "BASE_URL=${{vars.API_SERVER_URL_DEVELOPMENT}}" >> .env.development | |
echo "DOMAIN_URL=${{vars.WEB_URL_DEVELOPMENT}}" >> .env.development | |
working-directory: ${{ vars.FE_DIRECTORY }} | |
- name: Build | |
run: | | |
yarn build:dev | |
working-directory: ${{ vars.FE_DIRECTORY }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ vars.FE_DIRECTORY }} | |
file: ${{ vars.FE_DIRECTORY }}/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/dong-gle-frontend-dev:latest | |
platforms: linux/amd64 | |
deploy: | |
needs: build | |
uses: ./.github/workflows/deploy-dev.yml | |
secrets: inherit |