-
Notifications
You must be signed in to change notification settings - Fork 40
74 lines (63 loc) · 2.25 KB
/
default.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: default
on:
push:
branches:
- main
schedule:
- cron: '0 3 * * *'
pull_request:
branches:
- '**'
env:
REPOSITORY: andreysenov/firebase-tools
VERSION: 13.12.0
jobs:
firebase-tools:
runs-on: ubuntu-latest
strategy:
matrix:
context: [
{
dockerfile: Dockerfile,
node: node-lts,
os: slim,
platforms: 'linux/amd64,linux/arm64',
},
{
dockerfile: Dockerfile.node20,
node: node-20,
os: slim,
platforms: 'linux/amd64,linux/arm64',
}
]
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
if: ${{ github.event_name != 'pull_request' }}
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Set push argument
if: ${{ github.event_name != 'pull_request' }}
run: echo PUSH_ARG="--push" >> $GITHUB_ENV
- name: Set extra tags if needed
if: ${{ github.event_name != 'pull_request' && matrix.context.dockerfile == 'Dockerfile' }}
run: echo EXTRA_TAGS="-t ${{ env.REPOSITORY }}:${{ env.VERSION }} -t ${{ env.REPOSITORY }}:latest-${{ matrix.context.os }} -t ${{ env.REPOSITORY }}:latest" >> $GITHUB_ENV
- name: Build the Docker image
run: >
docker buildx build . ${PUSH_ARG} --no-cache --pull
--platform ${{ matrix.context.platforms }}
-f ${{ matrix.context.dockerfile }}
-t ${{ env.REPOSITORY }}:${{ env.VERSION }}-${{ matrix.context.node }}
-t ${{ env.REPOSITORY }}:${{ env.VERSION }}-${{ matrix.context.node }}-${{ matrix.context.os }}
-t ${{ env.REPOSITORY }}:latest-${{ matrix.context.node }}
-t ${{ env.REPOSITORY }}:latest-${{ matrix.context.node }}-${{ matrix.context.os }}
${EXTRA_TAGS}
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
--build-arg VERSION=${{ env.VERSION }}
--build-arg VCS_REF=${{ github.sha }}