-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (58 loc) · 1.82 KB
/
build.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
name: build_on_push
on:
push:
branches:
- main
- migrations
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_SECRET }}
- name: Get current date
id: date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
- name: Extract metadata for main branch
if: github.ref == 'refs/heads/main'
id: meta_main
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_USERNAME }}/${{ vars.DOCKER_REPOSITORY }}
tags: |
edge
${{ env.DATE }}
- name: Extract metadata for migrations branch
if: github.ref == 'refs/heads/migrations'
id: meta_migrations
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_USERNAME }}/${{ vars.DOCKER_REPOSITORY }}
tags: |
${{ env.DATE }}-${{ vars.DOCKER_MIGRATIONS_SUFFIX }}
- name: Build and push Docker images for main
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
file: deployment/Dockerfile
context: .
tags: ${{ steps.meta_main.outputs.tags }}
push: true
- name: Build and push Docker images for migrations
if: github.ref == 'refs/heads/migrations'
uses: docker/build-push-action@v6
with:
file: deployment/Dockerfile
context: .
tags: ${{ steps.meta_migrations.outputs.tags }}
push: true