Skip to content

add ci

add ci #1

Workflow file for this run

name: Continuous Integration
on:
pull_request: { branches: [ "main" ] }
push:
branches: [ "main" ]
tags: [ "*" ]
env:
GIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
jobs:
build:
name: "Build Image"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- id: generate-image-tag
name: Generate Image Tag
env:
ref_name: "${{ github.ref_name }}"
head_ref: "${{ github.head_ref }}"
run: |
head_ref="${head_ref/\//-}"
ref_name="${head_ref:-${ref_name/main/latest}}"
echo "::set-output name=imageTag::${ref_name#v}"
- name: Login to Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Backend
uses: docker/build-push-action@v2
with:
context: ./api
push: true
tags: |
ghcr.io/${{ github.repository }}/backend:${{ steps.generate-image-tag.outputs.imageTag }}
ghcr.io/${{ github.repository }}/backend:${{ github.event.pull_request.head.sha || github.sha }}
build-args: |
COMMIT_SHA=${{ github.sha }}
HF_TOKEN=${{ secrets.HF_TOKEN }}