@@ -16,15 +16,15 @@ jobs:
1616 runs-on : ubuntu-latest
1717 strategy :
1818 matrix :
19- node-version : [12 .x, 14.x ]
20- mongodb-version : [4.2, 4.4 ]
19+ node-version : [14 .x, 16.x, 20, lts/* ]
20+ mongodb-version : [4.4, 5.0, 6.0 ]
2121
2222 steps :
2323 - name : Git Checkout
24- uses : actions/checkout@v2
24+ uses : actions/checkout@v3
2525
2626 - name : Use Node.js ${{ matrix.node-version }}
27- uses : actions/setup-node@v1
27+ uses : actions/setup-node@v3
2828 with :
2929 node-version : ${{ matrix.node-version }}
3030
@@ -40,54 +40,51 @@ jobs:
4040 - name : Send Coverage
4141 run : npm run-script coverage
4242
43- publish_dev :
44- name : Publish dev branch to Docker Hub
43+ publish :
44+ name : Publish to Docker Hub
4545 needs : test
4646 runs-on : ubuntu-latest
47- if : github.ref == 'refs/heads/dev' && github.repository_owner == 'nightscout'
47+ if : ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ dev') && github.repository_owner == 'nightscout'
4848 env :
4949 DOCKER_IMAGE : nightscout/cgm-remote-monitor
50+ PLATFORMS : linux/amd64,linux/arm64
5051 steps :
52+ - name : Set up QEMU
53+ uses : docker/setup-qemu-action@v1
54+ - name : Set up Docker Buildx
55+ uses : docker/setup-buildx-action@v1
5156 - name : Login to Docker Hub
5257 uses : docker/login-action@v1
5358 with :
5459 username : ${{ secrets.DOCKER_USER }}
5560 password : ${{ secrets.DOCKER_PASS }}
5661 - name : Clean git Checkout
5762 if : success()
58- uses : actions/checkout@v2
63+ uses : actions/checkout@v3
5964 - name : Build, tag and push the dev Docker image
60- if : success()
61- run : |
62- docker build --no-cache=true -t ${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }} .
63- docker image push ${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }}
64- docker tag ${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }} ${{ env.DOCKER_IMAGE }}:latest_dev
65- docker image push ${{ env.DOCKER_IMAGE }}:latest_dev
66-
67- publish_master :
68- name : Publish master branch to Docker Hub
69- needs : test
70- runs-on : ubuntu-latest
71- if : github.ref == 'refs/heads/master' && github.repository_owner == 'nightscout'
72- env :
73- DOCKER_IMAGE : nightscout/cgm-remote-monitor
74- steps :
75- - name : Login to Docker Hub
76- uses : docker/login-action@v1
65+ if : success() && github.ref == 'refs/heads/dev'
66+ uses : docker/build-push-action@v2
7767 with :
78- username : ${{ secrets.DOCKER_USER }}
79- password : ${{ secrets.DOCKER_PASS }}
80- - name : Clean git Checkout
81- if : success()
82- uses : actions/checkout@v2
83- - name : get-npm-version
84- if : success()
68+ context : .
69+ push : true
70+ no-cache : true
71+ platforms : ${{ env.PLATFORMS }}
72+ tags : |
73+ ${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }}
74+ ${{ env.DOCKER_IMAGE }}:latest_dev
75+
76+ - name : Get Nightscout release version
77+ if : success() && github.ref == 'refs/heads/master'
8578 id : package-version
8679 uses : martinbeentjes/npm-get-version-action@master
8780 - name : Build, tag and push the master Docker image
88- if : success()
89- run : |
90- docker build --no-cache=true -t ${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }} .
91- docker image push ${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }}
92- docker tag ${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }} ${{ env.DOCKER_IMAGE }}:latest
93- docker image push ${{ env.DOCKER_IMAGE }}:latest
81+ if : success() && github.ref == 'refs/heads/master'
82+ uses : docker/build-push-action@v2
83+ with :
84+ context : .
85+ push : true
86+ no-cache : true
87+ platforms : ${{ env.PLATFORMS }}
88+ tags : |
89+ ${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }}
90+ ${{ env.DOCKER_IMAGE }}:latest
0 commit comments