Merge pull request #90 from cthit/workflows #6
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
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
name: "Frontend CI" | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: Install dependencies | |
run: npm install | |
working-directory: frontend | |
- name: Build | |
run: npm run build | |
working-directory: frontend | |
docker: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile | |
push: ${{ github.ref == 'refs/heads/main' }} | |
tags: ghcr.io/cthit/bookit-node-frontend:latest |