This repository has been archived by the owner on Sep 19, 2024. It is now read-only.
Merge pull request #11 from bemble/fix_delete_download #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: test on arm (raspberry pi) | |
# TODO: split built to mutualise front when multiple platforms | |
name: docker-image | |
on: | |
push: | |
branches: | |
- "main" | |
release: | |
types: [published] | |
jobs: | |
build: | |
name: Build container | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.HUB_TOKEN }} | |
- name: Log in to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Compute app environment and docker tags | |
id: compute-vars | |
run: | | |
if [[ "${{ github.event_name }}" == "release" ]]; then | |
echo "::set-output name=app-version::${{ github.event.release.tag_name }}" | |
echo "::set-output name=docker-tag1::latest" | |
echo "::set-output name=docker-tag2::${{ github.event.release.tag_name }}" | |
else | |
echo "::set-output name=app-version::${{ github.sha }}" | |
echo "::set-output name=docker-tag1::develop" | |
echo "::set-output name=docker-tag2::${{ github.sha }}" | |
fi | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64 | |
#platforms: linux/amd64,linux/arm/v6,linux/arm/v7 | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.compute-vars.outputs.docker-tag1 }} | |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.compute-vars.outputs.docker-tag2 }} | |
${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.compute-vars.outputs.docker-tag1 }} | |
${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.compute-vars.outputs.docker-tag2 }} | |
build-args: | | |
APP_VERSION=${{ steps.compute-vars.outputs.app-version }} | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
sync-description: | |
name: Docker Hub - Sync description | |
needs: build | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Prepare README | |
run: | | |
cat README.md | sed -e 's/ghcr.io\///g' > README_hub.md | |
- name: Sync README and description | |
uses: bemble/sync-readme@v1.0.0 | |
with: | |
pass: ${{ secrets.HUB_TOKEN }} | |
totp_secret: ${{ secrets.HUB_TOTP_SECRET }} | |
description: true | |
readme: ./README_hub.md |