2022-04-23 18:12:01 +03:00
|
|
|
name: Build and release docker image
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
push_to_registry:
|
|
|
|
name: Push Docker image to Docker Hub
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check out the repo
|
2022-04-23 21:38:18 +03:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
2022-04-23 18:12:01 +03:00
|
|
|
|
|
|
|
- name: Log in to Docker Hub
|
|
|
|
if: github.event_name != 'pull_request'
|
2022-04-23 21:38:18 +03:00
|
|
|
uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7
|
2022-04-23 18:12:01 +03:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
|
|
|
|
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
2022-04-23 21:38:18 +03:00
|
|
|
uses: docker/metadata-action@f2a13332ac1ce8c0a71aeac48a150dbb1838ab67
|
2022-04-23 18:12:01 +03:00
|
|
|
with:
|
|
|
|
images: |
|
2022-04-23 21:39:42 +03:00
|
|
|
${{ github.repository_owner }}/maloja
|
2022-04-23 18:12:01 +03:00
|
|
|
# generate Docker tags based on the following events/attributes
|
|
|
|
tags: |
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
flavor: |
|
|
|
|
latest=true
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
2022-04-23 21:38:18 +03:00
|
|
|
uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480
|
2022-04-23 18:12:01 +03:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2022-04-23 21:38:18 +03:00
|
|
|
uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25
|
2022-04-23 18:12:01 +03:00
|
|
|
|
|
|
|
- name: Cache Docker layers
|
2022-04-23 21:38:18 +03:00
|
|
|
uses: actions/cache@48af2dc4a9e8278b89d7fa154b955c30c6aaab09
|
2022-04-23 18:12:01 +03:00
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-buildx-
|
|
|
|
|
|
|
|
- name: Build and push Docker image
|
2022-04-23 21:38:18 +03:00
|
|
|
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
|
2022-04-23 18:12:01 +03:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: Containerfile
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2022-04-24 17:12:11 +03:00
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
2022-04-23 18:12:01 +03:00
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
|
|
|
|
|
|
|
# Temp fix
|
|
|
|
# https://github.com/docker/build-push-action/issues/252
|
|
|
|
# https://github.com/moby/buildkit/issues/1896
|
|
|
|
- name: Move cache
|
|
|
|
run: |
|
|
|
|
rm -rf /tmp/.buildx-cache
|
|
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
|
|
|
|
|
|
|
- name: Update Readme and short description
|
2022-04-23 21:38:18 +03:00
|
|
|
uses: peter-evans/dockerhub-description@836d7e6aa8f6f32dce26f5a1dd46d3dc24997eae
|
2022-04-23 18:12:01 +03:00
|
|
|
continue-on-error: true
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
|
|
|
|
repository: krateng/maloja
|
|
|
|
short-description: ${{ github.event.repository.description }}
|