-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (31 loc) · 1.14 KB
/
docker-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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@7ca345011ac4304463197fac0e56eab1bc7e6af0
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/onboardlite:${{ steps.extract_branch.outputs.branch }}
- name: Push Docker image
run: docker push ghcr.io/hackucf/onboardlite:${{ steps.extract_branch.outputs.branch }}