-
Notifications
You must be signed in to change notification settings - Fork 2
32 lines (28 loc) · 1.01 KB
/
base-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: Base image build
on:
push:
tags-ignore:
branches:
- main
pull_request:
env:
TAG: ${{ github.event_name == 'push' && github.ref_name || github.head_ref }}
jobs:
build_and_push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
- name: Build image
run: cd base && JOBS=$(nproc) docker compose build
- name: Log in to registry
if: github.event_name == 'push'
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Push tagged image
if: github.event_name == 'push' && github.ref_type == 'tag'
run: docker push ghcr.io/cnpem/lnls-debian-11-epics-7:$TAG
- name: Push latest image
if: github.event_name == 'push' && github.ref_type == 'branch'
run: docker tag ghcr.io/cnpem/lnls-debian-11-epics-7:$TAG ghcr.io/cnpem/lnls-debian-11-epics-7:latest && docker push ghcr.io/cnpem/lnls-debian-11-epics-7:latest