-
Notifications
You must be signed in to change notification settings - Fork 37
62 lines (56 loc) · 1.75 KB
/
releasetag.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
name: Release Tagging
on:
release:
types: [ "published" ]
jobs:
tag-remote:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get tag
id: get_tag
run: |
echo "::set-output name=IMAGE_TAG::$(echo $GITHUB_REF | cut -d / -f 3)"
- name: Set up qemu
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login --username "${{ vars.DOCKER_USERNAME }}" --password-stdin
- name: Build image
env:
GITHUB_REPOSITORY: ${{ github.repository }}
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
DOCKER_FOLDERS: "axis-ptz,egi,mqtt,notebook-server,piaware,tracker,pan-tilt-pi"
DOCKER_NAMESPACE: ${{ vars.DOCKER_NAMESPACE }}
RELEASE_NAME: ${{ github.event.release.name }}
TAG_NAME: ${{ github.event.release.tag_name }}
PROJECT_NAME: "skyscan"
run: |
IFS=","
read -ra ARR <<< "$DOCKER_FOLDERS"
for folder in "${ARR[@]}"
do
IFS="/"
read -ra NAMEFOLDER <<< $folder
SUBNAME=${NAMEFOLDER[0]}
PUBLISHNAME=""
if [ $NAMEFOLDER != $SUBNAME ]; then
PUBLISHNAME=$PROJECT_NAME-$folder-$SUBNAME
else
PUBLISHNAME=$PROJECT_NAME-$folder
fi
echo "TAGGING..."
echo $PUBLISHNAME
echo $RELEASE_NAME
echo $TAG_NAME
docker buildx build $folder \
--push \
--tag $DOCKER_NAMESPACE/$PUBLISHNAME:$TAG_NAME \
--platform linux/arm64,linux/amd64
done