61 lines
1.8 KiB
YAML
61 lines
1.8 KiB
YAML
|
name: Build and push to registry
|
||
|
|
||
|
on:
|
||
|
push:
|
||
|
tags:
|
||
|
- '*'
|
||
|
|
||
|
jobs:
|
||
|
push_to_registry:
|
||
|
name: Push Docker image to Docker Hub
|
||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- name: Check out the repo
|
||
|
uses: actions/checkout@v2
|
||
|
|
||
|
- name: Get the version
|
||
|
id: get_version
|
||
|
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
|
||
|
|
||
|
- name: Set up Docker Buildx
|
||
|
uses: docker/setup-buildx-action@v1
|
||
|
|
||
|
- name: Cache Docker layers
|
||
|
uses: actions/cache@v2
|
||
|
with:
|
||
|
path: /tmp/.buildx-cache
|
||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||
|
restore-keys: |
|
||
|
${{ runner.os }}-buildx-
|
||
|
|
||
|
- name: Login to DockerHub
|
||
|
uses: docker/login-action@v1
|
||
|
with:
|
||
|
username: ${{ secrets.REGISTRY_LOGIN }}
|
||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||
|
|
||
|
- name: Push dataupdater to Docker Hub
|
||
|
uses: docker/build-push-action@v2
|
||
|
with:
|
||
|
context: .
|
||
|
build-args: |
|
||
|
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||
|
tags: |
|
||
|
${{ secrets.REGISTRY_NAME }}/twhelp-dataupdater:latest
|
||
|
${{ secrets.REGISTRY_NAME }}/twhelp-dataupdater:${{ steps.get_version.outputs.VERSION }}
|
||
|
file: ./build/dataupdater/Dockerfile
|
||
|
push: true
|
||
|
|
||
|
- name: Push cron to Docker Hub
|
||
|
uses: docker/build-push-action@v2
|
||
|
with:
|
||
|
context: .
|
||
|
build-args: |
|
||
|
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||
|
tags: |
|
||
|
${{ secrets.REGISTRY_NAME }}/twhelp-cron:latest
|
||
|
${{ secrets.REGISTRY_NAME }}/twhelp-cron:${{ steps.get_version.outputs.VERSION }}
|
||
|
file: ./build/cron/Dockerfile
|
||
|
push: true
|