Merge pull request #66 from traccar/v4.11

Add GitHub Actions workflow to v4.11
This commit is contained in:
Maxim Zalysin 2021-01-07 20:02:32 +03:00 committed by GitHub
commit a331ffe9a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 1 deletions

54
.github/workflows/build-push.yml vendored Normal file
View File

@ -0,0 +1,54 @@
---
name: Build and push docker images
env:
DOCKERHUB_REPOSITORY: traccar/traccar
on:
push:
branches:
- master
- v[0-9]+.[0-9]+
jobs:
docker-build-push:
name: Build and push docker images
runs-on: ubuntu-20.04
strategy:
matrix:
base: [alpine, debian]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set environment DOCKERHUB_IMAGE_TAGS on master
if: github.ref == 'refs/heads/master' && matrix.base == 'alpine'
run: echo "DOCKERHUB_IMAGE_TAGS=$DOCKERHUB_REPOSITORY:latest" >> $GITHUB_ENV
- name: Set environment DOCKERHUB_IMAGE_TAGS
if: github.ref != 'refs/heads/master'
shell: bash
run: |
_BRANCH=${GITHUB_REF##*/}
_VERSION=${_BRANCH#v*}
_MAJOR_VERSION=${_VERSION%.*}
_DOCKERHUB_IMAGE_TAGS="$DOCKERHUB_REPOSITORY:$_VERSION-${{ matrix.base }}"
_DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_MAJOR_VERSION-${{ matrix.base }}"
_DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:${{ matrix.base }}"
if [ "${{ matrix.base }}" == "alpine" ]; then
_DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_VERSION"
_DOCKERHUB_IMAGE_TAGS+=",$DOCKERHUB_REPOSITORY:$_MAJOR_VERSION"
fi
echo "DOCKERHUB_IMAGE_TAGS=$_DOCKERHUB_IMAGE_TAGS" >> $GITHUB_ENV
- name: Build and push
if: env.DOCKERHUB_IMAGE_TAGS != ''
uses: docker/build-push-action@v2
with:
file: ${{ matrix.base }}/Dockerfile
tags: ${{ env.DOCKERHUB_IMAGE_TAGS }}
push: true

View File

@ -10,7 +10,7 @@ DockerHub image: <https://hub.docker.com/r/traccar/traccar>
[![](https://images.microbadger.com/badges/image/traccar/traccar:4.11.svg)](https://microbadger.com/images/traccar/traccar:4.11)
### Available tags:
- **4.11-alpine**, **4-alpine**, **4.11**, **alpine**, **latest**
- **4.11-alpine**, **4-alpine**, **alpine**, **4.11**, **4**, **latest**
- **4.11-debian**, **4-debian**, **debian**
- **4.10-alpine**, **4.10**
- **4.10-debian**