-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (64 loc) · 2.13 KB
/
Copy pathdocker-image.yml
File metadata and controls
72 lines (64 loc) · 2.13 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: CI
on:
push:
workflow_dispatch:
env:
IMAGE_NAME: bsidems/bside-cms
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint code
run: yarn lint
- name: Type check code
run: yarn ts-check
- name: Check code style
run: yarn prettier
build:
name: Build and push image
needs: lint
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check required secrets and variables
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
CMS_URL: ${{ vars.CMS_URL }}
run: |
missing=0
if [ -z "${DOCKERHUB_TOKEN}" ]; then
echo "Missing repository secret: DOCKERHUB_TOKEN"
missing=1
fi
if [ -z "${CMS_URL}" ]; then
echo "Missing repository variable: CMS_URL"
missing=1
fi
exit "${missing}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: bsidems
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64
tags: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ github.sha }}
build-args: |
CMS_URL=${{ vars.CMS_URL }}
cache-from: type=gha
cache-to: type=gha,mode=max