-
Notifications
You must be signed in to change notification settings - Fork 62
37 lines (29 loc) · 1.23 KB
/
devx-build.yaml
File metadata and controls
37 lines (29 loc) · 1.23 KB
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
name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up variables
id: vars
run: |
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
echo "branch=$(echo ${GITHUB_REF##*/} | tr '/' '-')" >> $GITHUB_OUTPUT
- name: Log in to GitHub Container Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and tag the Docker image
run: |
IMAGE=ghcr.io/$(echo ${{ github.repository_owner }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')/devx
docker build .project/cache --file .project/brev.Containerfile --tag $IMAGE:${{ steps.vars.outputs.timestamp }}
docker tag $IMAGE:${{ steps.vars.outputs.timestamp }} $IMAGE:${{ steps.vars.outputs.branch }}
- name: Push both tags to GHCR
run: |
IMAGE=ghcr.io/$(echo ${{ github.repository_owner }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')/devx
docker push $IMAGE:${{ steps.vars.outputs.timestamp }}
docker push $IMAGE:${{ steps.vars.outputs.branch }}