Skip to content

CI/CD Workflow

CI/CD Workflow #48

name: CI/CD Workflow
on:
push:
branches:
- main
- dev
schedule:
- cron: "21 18 * * 3"
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract branch name
id: extract_branch
run: echo "::set-output name=branch::$(echo ${GITHUB_REF#refs/heads/})"
- name: Build Docker image
run: docker build --target prod -t onboardlite:${{ steps.extract_branch.outputs.branch }} .
- name: Tag Docker image
run: docker tag onboardlite:${{ steps.extract_branch.outputs.branch }} ghcr.io/hackucf/plinkonboard:${{ steps.extract_branch.outputs.branch }}
- name: Push Docker image
run: docker push ghcr.io/hackucf/plinkonboard:${{ steps.extract_branch.outputs.branch }}