-
Notifications
You must be signed in to change notification settings - Fork 7
49 lines (41 loc) · 1.52 KB
/
docker-publish.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
name: Docker
on:
push:
paths:
# temporary disabled
- '*Dockerfile'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# https://github.com/actions/checkout/issues/701
fetch-depth: 0
- run: echo "GIT_TAG=`echo v$(sed -nE 's/^.*ROUTEROS_VERSION="([0-9]+\.[0-9]+).*?"/\1/p' Dockerfile)`" >> $GITHUB_ENV
- name: Log into registry #1
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER1 }}
password: ${{ secrets.DOCKERHUB_TOKEN1 }}
- name: Build and push Docker image to the repo #1
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ secrets.DOCKERHUB_USER1 }}/routeros:latest,${{ secrets.DOCKERHUB_USER1 }}/routeros:${{ env.GIT_TAG }}
- name: Log into registry #2
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER2 }}
password: ${{ secrets.DOCKERHUB_TOKEN2 }}
- name: Build and push Docker image to the repo #2
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ secrets.DOCKERHUB_USER2 }}/routeros:latest,${{ secrets.DOCKERHUB_USER2 }}/routeros:${{ env.GIT_TAG }}