-
Notifications
You must be signed in to change notification settings - Fork 99
49 lines (39 loc) · 1.31 KB
/
build-containers.yaml
File metadata and controls
49 lines (39 loc) · 1.31 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
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Build containers
on:
# Ensure we're run after tests
workflow_run:
workflows: [ "Test application" ]
branches: [ "master" ]
types:
- completed
# Allow workflow to be manually run from the GitHub UI
workflow_dispatch:
# Also, re-deploy once per week to ensure we refresh our versions
# of the app's runtime
schedule:
- cron: "0 0 * * 0"
env:
TEST_URL: https://phpdocker.io/
jobs:
build-and-deploy:
# We only deploy master
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# We could build-and-push deploy, but it makes that step on the pipeline too
# complex to follow effectively. Instead, set BUILD_TAG here so that we can
# run build, push and deploy separately
- name: Set build tag
run: |
echo "BUILD_TAG=$(date +'%Y-%m-%d-%H-%M-%S')-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build containers
run: make build-and-push -e BUILD_TAG=${BUILD_TAG}