Skip to content

Commit

Permalink
Split workflows into CI and CD
Browse files Browse the repository at this point in the history
  • Loading branch information
ed-asriyan committed Jun 17, 2023
1 parent 8984799 commit 6340be0
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 137 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/cd-push-dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CD | Push to DockerHub

on:
workflow_run:
workflows:
- CI | Build & Test
types:
- completed
branches:
- master

jobs:
push:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
image: [lottie-to-apng, lottie-to-gif, lottie-to-png, lottie-to-png, lottie-to-webp]
steps:
- name: Download ${{ matrix.image }} image as artefact
uses: ishworkh/docker-image-artifact-download@v2.0.1
with:
workflow: CI | Build & Test
workflow_run_id: ${{ github.event.workflow_run.workflow.id }}
image: ${{ matrix.image }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push ${{ matrix.image }}
uses: docker/build-push-action@v3
with:
target: ${{ matrix.image }}
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}:latest
push: true
78 changes: 78 additions & 0 deletions .github/workflows/ci-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: CI | Build & Test

on:
push:
pull_request:

jobs:
build:
name: Build docker images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Build lottie-to-apng
uses: docker/build-push-action@v3
with:
target: lottie-to-apng
tags: lottie-to-apng
load: true

- name: Upload lottie-to-apng as artifact
uses: ishworkh/docker-image-artifact-upload@v2.0.1
with:
image: lottie-to-apng

- name: Build lottie-to-gif
uses: docker/build-push-action@v3
with:
target: lottie-to-gif
tags: lottie-to-gif
load: true

- name: Upload lottie-to-gif as artifact
uses: ishworkh/docker-image-artifact-upload@v2.0.1
with:
image: lottie-to-gif

- name: Build lottie-to-png
uses: docker/build-push-action@v3
with:
target: lottie-to-png
tags: lottie-to-png
load: true

- name: Upload lottie-to-png as artifact
uses: ishworkh/docker-image-artifact-upload@v2.0.1
with:
image: lottie-to-png

- name: Build lottie-to-webp
uses: docker/build-push-action@v3
with:
target: lottie-to-webp
tags: lottie-to-webp
load: true

- name: Upload lottie-to-webp as artifact
uses: ishworkh/docker-image-artifact-upload@v2.0.1
with:
image: lottie-to-webp

test:
name: Run tests
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
image: [lottie-to-apng, lottie-to-gif, lottie-to-png, lottie-to-webp]
steps:
- name: Download ${{ matrix.image }} image as artefact
uses: ishworkh/docker-image-artifact-download@v2.0.1
with:
image: ${{ matrix.image }}

- uses: actions/checkout@v3

- name: Run ${{ matrix.image }} tests
run: docker run --rm -v $(pwd)/test-files:/source ${{ matrix.image }}
136 changes: 0 additions & 136 deletions .github/workflows/ci.yml

This file was deleted.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Lottie Animations (.json) and Telegram Stickers (*.tgs) to GIF/PNG/APNG/WEBP converter ![docker workflow](https://github.com/ed-asriyan/tgs-to-gif/actions/workflows/ci.yml/badge.svg)
# Lottie Animations (.json) and Telegram Stickers (*.tgs) to GIF/PNG/APNG/WEBP converter
![docker workflow](https://github.com/ed-asriyan/tgs-to-gif/actions/workflows/ci-build-and-test.yml/badge.svg)
![docker workflow](https://github.com/ed-asriyan/tgs-to-gif/actions/workflows/cd-push-dockerhub.yml/badge.svg)

<hr/>
<h3 align="center">
Expand Down

0 comments on commit 6340be0

Please sign in to comment.