Skip to content

CD | Release & Push to DockerHub #18

CD | Release & Push to DockerHub

CD | Release & Push to DockerHub #18

Workflow file for this run

name: CD | Release & Push to DockerHub
on:
push:
tags:
- 'v[0-9].[0-9]+.[0-9]+'
jobs:
build-docker-and-linux:
name: Build Docker image & Linux executable
uses: ./.github/workflows/build-linux-and-docker.yml
strategy:
matrix:
arch:
- arm64
- amd64
with:
output-artifact-name: lottie-to-png.linux.${{ matrix.arch }}
arch: ${{ matrix.arch }}
version: ${{ github.ref_name }}
build-darwin:
name: Build Darwin executable
uses: ./.github/workflows/build-darwin.yml
with:
output-artifact-name: lottie-to-png.darwin.amd64
version: ${{ github.ref_name }}
build-windows:
name: Build Windows executable
uses: ./.github/workflows/build-windows.yml
with:
output-artifact-name: lottie-to-png.windows.amd64.exe
version: ${{ github.ref_name }}
push-docker-image:
name: Push images to DockerHub
needs: build-docker-and-linux
runs-on: ubuntu-latest
strategy:
matrix:
image:
- lottie-to-apng
- lottie-to-gif
- lottie-to-png
- lottie-to-webp
arch:
- amd64
- arm64
steps:
- name: Download ${{ matrix.image }} image as artifact
uses: ishworkh/[email protected]
with:
image: "${{ matrix.image }}:${{ matrix.arch }}"
- name: Tag image
run: docker image tag ${{ matrix.image }}:${{ matrix.arch }} ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:${{ matrix.arch }}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push ${{ matrix.image }} to DockerHub
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:${{ matrix.arch }}
push-docker-manifest:
name: Push manifest to DockerHub
needs: push-docker-image
runs-on: ubuntu-latest
strategy:
matrix:
format:
- apng
- gif
- png
- webp
steps:
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create manifest of latest tag
run: docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/lottie-to-${{ matrix.format }}:latest --amend ${{ secrets.DOCKERHUB_USERNAME }}/lottie-to-${{ matrix.format }}:amd64 --amend ${{ secrets.DOCKERHUB_USERNAME }}/lottie-to-${{ matrix.format }}:arm64
- name: Push manifest of latest tag
run: docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/lottie-to-${{ matrix.format }}:latest
- name: Create manifest of version tag
run: docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/lottie-to-${{ matrix.format }}:${{ github.ref_name }} --amend ${{ secrets.DOCKERHUB_USERNAME }}/lottie-to-${{ matrix.format }}:amd64 --amend ${{ secrets.DOCKERHUB_USERNAME }}/lottie-to-${{ matrix.format }}:arm64
- name: Push manifest of version tag
run: docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/lottie-to-${{ matrix.format }}:${{ github.ref_name }}
- name: Make format uppercase
id: format
uses: ASzc/change-string-case-action@v5
with:
string: ${{ matrix.format }}
- uses: actions/checkout@v4
- name: Find and replace FORMAT in readme for DockerHub
uses: ./.github/actions/replace-version
with:
file: README.dockerhub.md
old-string: FORMAT
new-string: ${{ steps.format.outputs.uppercase }}
- name: Find and replace format in readme for DockerHub
uses: ./.github/actions/replace-version
with:
file: README.dockerhub.md
old-string: format
new-string: ${{ matrix.format }}
- name: Update description at DockerHub
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ secrets.DOCKERHUB_USERNAME }}/lottie-to-${{ matrix.format }}
short-description: Converts Lottie Animations (.json / .lottie) and Telegram stickers (*.tgs) to ${{ steps.format.outputs.uppercase }}}
readme-filepath: README.dockerhub.md
create-release:
name: Release executables
needs:
- build-docker-and-linux
- build-darwin
- build-windows
runs-on: ubuntu-latest
strategy:
matrix:
file:
- linux.amd64
- linux.arm64
- darwin.amd64
- windows.amd64.exe
env:
filename: lottie-converter.${{ matrix.file }}.zip
steps:
- uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: lottie-to-png.${{ matrix.file }}
path: bin
- name: Archive Release
uses: thedoctor0/[email protected]
with:
type: 'zip'
path: bin
filename: ${{ env.filename }}
- name: Release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.filename }}
draft: true