-
-
Notifications
You must be signed in to change notification settings - Fork 2
43 lines (34 loc) · 1.46 KB
/
build-images.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
name: Build and release images
on:
- push
- pull_request
concurrency: build-${{ github.sha }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create SHA tag
id: sha_tag
run: |
tag=$(cut -c 1-7 <<< $GITHUB_SHA)
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Build postgresql-s3-backup image
run: docker build ./images/postgresql-s3-backup/ -t ghcr.io/quiltmc/postgresql-s3-backup:latest -t ghcr.io/quiltmc/postgresql-s3-backup:${{ steps.sha_tag.outputs.tag }}
- name: Build mongodb-s3-backup image
run: docker build ./images/mongodb-s3-backup/ -t ghcr.io/quiltmc/mongodb-s3-backup:latest -t ghcr.io/quiltmc/mongodb-s3-backup:${{ steps.sha_tag.outputs.tag }}
- name: Login to Github Container Registry
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images to the registry
if: github.ref == 'refs/heads/main'
run: |
docker push ghcr.io/quiltmc/postgresql-s3-backup:latest
docker push ghcr.io/quiltmc/postgresql-s3-backup:${{ steps.sha_tag.outputs.tag }}
docker push ghcr.io/quiltmc/mongodb-s3-backup:latest
docker push ghcr.io/quiltmc/mongodb-s3-backup:${{ steps.sha_tag.outputs.tag }}