Skip to content

Commit

Permalink
Add release creating to CD workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ed-asriyan committed Oct 24, 2023
1 parent 07307cd commit 82ee09f
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 97 deletions.
73 changes: 0 additions & 73 deletions .github/workflows/cd-push-dockerhub.yml

This file was deleted.

128 changes: 128 additions & 0 deletions .github/workflows/cd-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
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 }}

build-darwin:
name: Build Darwin executable
uses: ./.github/workflows/build-darwin.yml
with:
output-artifact-name: lottie-to-png.darwin.amd64

build-windows:
name: Build Windows executable
uses: ./.github/workflows/build-windows.yml
with:
output-artifact-name: lottie-to-png.windows.amd64.exe

push-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
platform:
- amd64
- arm64
steps:
- name: Download ${{ matrix.image }} image as artifact
uses: ishworkh/[email protected]
with:
image: "${{ matrix.image }}:${{ inputs.arch }}"

- name: Tag image
run: docker image tag ${{ matrix.image }}:${{ matrix.platform }} ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:${{ matrix.platform }}

- 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.platform }}

push-manifest:
name: Push manifest to DockerHub
needs: push-image
runs-on: ubuntu-latest
strategy:
matrix:
image:
- lottie-to-apng
- lottie-to-gif
- lottie-to-png
- lottie-to-webp
steps:
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Create manifest
run: docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:latest ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:${{ github.ref }} --amend ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:amd64 --amend ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:arm64

- name: Create manifest
run: docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:latest ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:${{ github.ref }} --amend ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:amd64 --amend ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:arm64

- name: Push manifest
run: docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:latest ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:${{ github.ref }}

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
2 changes: 1 addition & 1 deletion .github/workflows/test-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Download ${{ matrix.image }} image as artefact
- name: Download ${{ matrix.image }} image as artifact
uses: ishworkh/[email protected]
with:
image: lottie-to-${{ matrix.image }}:${{ inputs.arch }}
Expand Down
60 changes: 37 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Lottie Animations (.json) and Telegram Stickers (*.tgs) to GIF/PNG/APNG/WEBP converter
[![CI | Build & Test](https://github.com/ed-asriyan/lottie-converter/actions/workflows/ci-build-and-test.yml/badge.svg)](https://github.com/ed-asriyan/lottie-converter/actions/workflows/ci-build-and-test.yml)
[![CD | Push to DockerHub](https://github.com/ed-asriyan/lottie-converter/actions/workflows/cd-release.yml/badge.svg)](https://github.com/ed-asriyan/lottie-converter/actions/workflows/cd-release.yml)
[![CD | Release & Push to Dockerhub](https://github.com/ed-asriyan/lottie-converter/actions/workflows/cd-release.yml/badge.svg)](https://github.com/ed-asriyan/lottie-converter/actions/workflows/cd-release.yml)


<hr/>
Expand All @@ -10,7 +10,9 @@ To easily convert Telegram stickers to GIFs you can use Telegram Bot</br></br>
<hr/>

## How to use
There are two options: run using [Docker](https://www.docker.com/) and run from source.
There are 2 options:
* Run using [Docker](https://www.docker.com/). One-line command, the option requires only Docker installed
* Download and run compiled executable files. The option requires run-time dependecies installed

### Using Docker
Replace with directory with Lottie animations / Telegram stickers and run:
Expand Down Expand Up @@ -45,7 +47,39 @@ docker run --rm -e HEIGHT=256 -e WIDTH=256 -e FPS=30 -v /home/ed/Downloads/lotti

Results will be saved next to each source file in the same directory.

### From source
## Using compiled executables
1. Install run-time dependencies. Make sure the path to them present in `PATH` variable:
- **[gifski](https://gif.ski)** if you want to convert to GIF
- **[ffmpeg](https://ffmpeg.org)** if you want to convert to APNG
- **[img2webp](https://developers.google.com/speed/webp/docs/img2webp)** if you want to convert to WEBP
2. Download executable from [releases section of this repo](https://github.com/ed-asriyan/lottie-converter/releases) for your OS and arch
3. In downloaded archive find the following executable scripts:
- `lottie_to_apng.sh`
- `lottie_to_gif.sh`
- `lottie_to_png.sh`
- `lottie_to_webp.sh`

All of them have the same CLI:
```commandline
$ ./bin/lottie_to_gif.sh -h
usage: ./bin/lottie_to_gif.sh [--help] [--output OUTPUT] [--height HEIGHT] [--width WIDTH] [--threads THREADS] [--fps FPS] [--quality QUALITY] path
Lottie animations (.json) and Telegram stickers for Telegram (*.tgs) to animated .gif converter
Positional arguments:
path Path to .json or .tgs file to convert
Optional arguments:
-h, --help show this help message and exit
--output OUTPUT Output file path
--height HEIGHT Output image height. Default:
--width WIDTH Output image width. Default: 512
--fps FPS Output frame rate. Default: 50
--threads THREADS Number of threads to use. Default: number of CPUs
--quality QUALITY Output quality. Default: 90
```

# Build
1. Install dependencies
1. Make sure you have **C++17 compiler**, **make**, **[cmake](https://cmake.org)** and **[conan](https://conan.io)** tools installed; otherwise install them
2. Make sure you have the tools installed:
Expand Down Expand Up @@ -121,26 +155,6 @@ Results will be saved next to each source file in the same directory.
```
Results will be saved next to each source file in the same directory.
#### CLI arguments
```text
$ ./bin/lottie_to_gif.sh --help
usage: ./bin/lottie_to_gif.sh [--help] [--output OUTPUT] [--height HEIGHT] [--width WIDTH] [--threads THREADS] [--fps FPS] [--quality QUALITY] path
Lottie animations (.json) and Telegram stickers for Telegram (*.tgs) to animated .gif converter
Positional arguments:
path Path to .json or .tgs file to convert
Optional arguments:
-h, --help show this help message and exit
--output OUTPUT Output file path
--height HEIGHT Output image height. Default: 512
--width WIDTH Output image width. Default: 512
--fps FPS Output frame rate. Default: 50
--threads THREADS Number of threads to use. Default: number of CPUs
--quality QUALITY Output quality. Default: 90
```

## Notices
* What is lottie? - https://airbnb.design/lottie/
* You can download Telegram sticker files (.tgs) using [@Stickerdownloadbot](https://t.me/Stickerdownloadbot).
Expand Down

0 comments on commit 82ee09f

Please sign in to comment.