-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 2.55 KB
/
deploy.yml
File metadata and controls
69 lines (59 loc) · 2.55 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
name: Publish Docker
on:
push:
branches:
- main
schedule:
- cron: '0 3 * * *'
pull_request:
branches:
-'**'
env:
REPOSITORY: 42devs/image-firebase
VERSION: 10.9.2
FIREBASE_TOOLS_VERSION: 10.9.2
jobs:
firebase-tools:
runs-on: ubuntu-latest
strategy:
matrix:
context: [
{
dockerfile: Dockerfile,
node: node-lts,
os: alpine
}
]
steps:
- name: checkout
uses: actions/checkout@v2
- name: build docker image
run: >
docker build . --no-cache --pull
-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 }}
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
--build-arg VERSION=${{ env.VERSION}}
--build-arg VCS_REF=${{ github.sha }}
--build-arg FIREBASE_TOOLS_VERSION=${{ env.FIREBASE_TOOLS_VERSION }}
- name: login to docker
if: ${{ github.event_name != 'pull_request' }}
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Publish docker image
if: ${{ github.event_name != 'pull_request' }}
run: |
docker push ${{ env.REPOSITORY }}:${{ env.VERSION }}-${{ matrix.context.node }}
docker push ${{ env.REPOSITORY }}:${{ env.VERSION }}-${{ matrix.context.node }}-${{ matrix.context.os }}
docker push ${{ env.REPOSITORY }}:latest-${{ matrix.context.node }}
- name: Publish Latest image
if: ${{ github.event_name != 'pull_request' && matrix.context.dockerfile == 'Dockerfile' }}
run: |
docker tag ${{ env.REPOSITORY }}:${{ env.VERSION }}-${{ matrix.context.node }}-${{ matrix.context.os }} ${{ env.REPOSITORY }}:${{ env.VERSION }}
docker tag ${{ env.REPOSITORY }}:${{ env.VERSION }}-${{ matrix.context.node }}-${{ matrix.context.os }} ${{ env.REPOSITORY }}:latest-${{ matrix.context.os }}
docker tag ${{ env.REPOSITORY }}:${{ env.VERSION }}-${{ matrix.context.node }} ${{ env.REPOSITORY }}:latest
docker push ${{ env.REPOSITORY }}:${{ env.VERSION }}
docker push ${{ env.REPOSITORY }}:latest-${{ matrix.context.os }}
docker push ${{ env.REPOSITORY }}:latest