-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (52 loc) · 1.69 KB
/
build-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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright (c) 2024 Isaac Adams
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
name: Build Base Image
on:
push:
paths:
- 'Base.Dockerfile'
- 'requirements.txt'
- 'package.json'
- 'package-lock.json'
- '.github/workflows/build-base-image.yml'
concurrency:
group: deployment
env:
PROJECT_ID: crank-404520
SERVICE: crank
REGION: us-west1
ARTIFACT_REPO: crank-repository
jobs:
build-base-image:
permissions:
contents: 'read'
id-token: 'write'
packages: 'write'
runs-on: ubuntu-latest
steps:
- name: Check if last commit was a merge commit
id: check
run: |
if [[ "$(git log --merges -1 --pretty=%H)" != "$(git log -1 --pretty=%H)" ]]; then
echo "This was not a merge commit. Exiting..."
exit 1
fi
- name: Checkout code
uses: actions/checkout@v4
- name: Authenticate with GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Container to GitHub Container Registry
uses: docker/build-push-action@v5
with:
context: .
file: Base.Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}/crank-base:${{ github.sha }}
- name: Tag and Push Image as Latest
run: |
docker tag ghcr.io/${{ github.repository }}/crank-base:${{ github.sha }} ghcr.io/${{ github.repository }}/crank-base:latest
docker push ghcr.io/${{ github.repository }}/crank-base:latest