-
Notifications
You must be signed in to change notification settings - Fork 6
44 lines (34 loc) · 1.29 KB
/
docker-ubuntu2004.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
name: Docker Image [ubuntu2004]
on:
push:
tags:
- v*
- ubuntu2004-v*
jobs:
build:
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_DOCKER_REPOSITORY: docker.pkg.github.com/${{ github.repository }}
IMAGE_NAME: ubuntu2004
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build image [ubuntu2004]
run: |
docker build ./docker --file docker/Dockerfile.$IMAGE_NAME --tag $IMAGE_NAME
- name: Push image [ubuntu2004]
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
if [[ "$VERSION" =~ ^$IMAGE_NAME-v* ]]; then
VERSION="$(echo $VERSION | sed -e 's/^$IMAGE_NAME-v//')-pre"
elif [[ "$VERSION" =~ ^v* ]]; then
VERSION="$(echo $VERSION | sed -e 's/^v//')"
fi
fi
echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin
docker tag $IMAGE_NAME $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME:$VERSION
docker push $GITHUB_DOCKER_REPOSITORY/$IMAGE_NAME:$VERSION
docker logout