Skip to content

Build release

Build release #83

name: 'Build release'
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '30 3 * * *'
push:
branches: main
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKERHUB_REGISTRY: byteschneiderei/tobybatch-kimai2
steps:
- name: Set vars from payload
run: echo "kv=${{ github.event.client_payload.release.tag_name }}" >> $GITHUB_ENV
if: github.event.client_payload != null
- name: Checkout code
uses: actions/checkout@v2
- name: install lastversion
run: sudo apt-get update -y; sudo apt-get install --no-install-recommends -y python3 python3-pip; pip install lastversion
#- name: check remote lastversion
# id: remote_version
# run: echo "::set-output name=version::$(lastversion https://github.com/kevinpapst/kimai2)"
- name: get lastest 1.x version
id: remote_version
run: echo "::set-output name=version::$(lastversion https://github.com/kevinpapst/kimai2 --only '~^1\.')"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push FPM Dev
uses: docker/build-push-action@v2
with:
context: .
target: dev
build-args: |
KIMAI=${{steps.remote_version.outputs.version}}
TIMEZONE=Europe/London
BASE=fpm
tags: |
${{ env.DOCKERHUB_REGISTRY }}:fpm-${{steps.remote_version.outputs.version}}-dev
${{ env.DOCKERHUB_REGISTRY }}:fpm-dev
push: true
- name: Build and push FPM Prod
uses: docker/build-push-action@v2
with:
context: .
target: prod
build-args: |
KIMAI=${{steps.remote_version.outputs.version}}
TIMEZONE=Europe/London
BASE=fpm
tags: |
${{ env.DOCKERHUB_REGISTRY }}:fpm-${{steps.remote_version.outputs.version}}-prod
${{ env.DOCKERHUB_REGISTRY }}:fpm-latest
${{ env.DOCKERHUB_REGISTRY }}:fpm
${{ env.DOCKERHUB_REGISTRY }}:latest
push: true
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}