2022-03-29 23:07:12 +00:00
|
|
|
name: Build and Publish Docker Image
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
main:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout Repository
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
|
|
|
|
- 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: Login to GHCR
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2022-03-30 14:40:02 +00:00
|
|
|
- name: Get Variables
|
|
|
|
id: get-variables
|
|
|
|
run: |
|
|
|
|
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
|
|
|
|
echo ::set-output name=gh-username-lower::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')
|
2022-03-29 23:07:12 +00:00
|
|
|
|
|
|
|
- name: Build and push Image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
platforms: linux/amd64
|
|
|
|
tags: |
|
2022-04-01 03:06:25 +00:00
|
|
|
${{ steps.get-variables.outputs.gh-username-lower }}/libretranslate:${{ env.TAG }},
|
2022-03-30 14:40:02 +00:00
|
|
|
ghcr.io/${{ steps.get-variables.outputs.gh-username-lower }}/libretranslate:${{ env.TAG }}
|
2022-03-29 23:07:12 +00:00
|
|
|
push: true
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
env:
|
2022-03-30 14:40:02 +00:00
|
|
|
TAG: ${{ startsWith(github.ref, 'refs/tags/') && steps.get-variables.outputs.version || 'latest' }}
|