-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (54 loc) · 1.5 KB
/
jobs.yaml
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
name: Workflow
on:
pull_request:
branches:
- master
push:
branches:
- master
# This ensures that previous jobs for the PR are canceled when the PR is
# updated.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
build-container:
name: Build container image
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup buildx
uses: docker/setup-buildx-action@v1
- name: Build container
run: |
make docker
build-and-push-container:
name: Build and push container image
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
needs:
- build-container
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set build time
run: |
echo "BUILD_TIME=$(date -u +%Y-%m-%dT%H-%M-%SZ 2>/dev/null)" >> $GITHUB_ENV
echo "HUMAN_DATE=$(date 2>/dev/null)" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v1
with:
platforms: linux/amd64
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: alevsk/alevsk.com
push: true
build-args: build_time=${{env.HUMAN_DATE }}
tags: latest, RELEASE.${{ env.BUILD_TIME }}