-
Notifications
You must be signed in to change notification settings - Fork 3
76 lines (67 loc) · 2.68 KB
/
Copy pathdefault.yml
File metadata and controls
76 lines (67 loc) · 2.68 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
73
74
75
76
name: default
on:
push:
branches:
- main
schedule:
- cron: '0 3 * * *'
pull_request:
branches:
- '**'
env:
REPOSITORY: andreysenov/node-gyp
VERSION: 8.4.1
jobs:
node-gyp:
runs-on: ubuntu-latest
strategy:
matrix:
context: [
{
dockerfile: Dockerfile,
node: node-lts,
os: alpine
},
{
dockerfile: Dockerfile.node14,
node: node-14,
os: alpine
},
{
dockerfile: Dockerfile.node12,
node: node-12,
os: alpine
}
]
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Build the 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 }}
- name: Login to Docker Hub
if: ${{ github.event_name != 'pull_request' }}
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Publish the 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 the Docker image (Latest)
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