-
Notifications
You must be signed in to change notification settings - Fork 3
32 lines (27 loc) · 973 Bytes
/
docker-image.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
name: Docker Image CI
on:
push:
branches: [ "master" ]
pull_request:
# branches: [ "master" ]
jobs:
build:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag newsgen:${{ env.BRANCH_NAME }}
- name: Login to registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u kubilus1 --password-stdin
- name: Push branch
run: |
docker tag newsgen:${{ env.BRANCH_NAME }} ghcr.io/kubilus1/newsgen:${{ env.BRANCH_NAME }}
docker push ghcr.io/kubilus1/newsgen:${{ env.BRANCH_NAME }}
if: github.ref != 'refs/heads/master'
- name: Push if master
run: |
docker tag newsgen:${{ env.BRANCH_NAME }} ghcr.io/kubilus1/newsgen:latest
docker push ghcr.io/kubilus1/newsgen:latest
if: github.ref == 'refs/heads/master'