From a9b6e0218a962614c5c8c1719ae154168e696c25 Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 13 Mar 2021 02:11:57 +0100 Subject: [PATCH] Add CI/CD --- .github/workflows/build_and_release.yml | 42 +++++++++++++++++++++++++ .github/workflows/validate_json.yml | 2 +- studios.json | 38 ---------------------- studios/e/studio.json | 15 +++++++++ studios/game-show-network/studio.json | 14 +++++++++ studios/netflix/studio.json | 16 ++++++++++ 6 files changed, 88 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/build_and_release.yml delete mode 100644 studios.json create mode 100644 studios/e/studio.json create mode 100644 studios/game-show-network/studio.json create mode 100644 studios/netflix/studio.json diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.yml new file mode 100644 index 0000000..d4bff6a --- /dev/null +++ b/.github/workflows/build_and_release.yml @@ -0,0 +1,42 @@ +name: Build & release + +on: + push: + branches: + - master + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: "14" + - name: Install build dependencies + run: npm install svgo + - name: Create dist directory + run: mkdir dist + - name: Copy source SVGs + run: cp -r studios dist/ + - name: Optimize source SVGs + run: npx svgo --multipass dist/studios/**/*.svg + - name: ImageMagick Action + uses: jruipinto/ImageMagick-action@v1 + with: + # ImageMagick command to be executed + command: mogrify -format webp dist/studios/**/*.svg + - name: Build studios.json + run: jq -s '.[0]=([.[]]|flatten)|.[0]' studios/**/studio.json > dist/studios.json + - name: Remove individual JSON files + run: rm dist/studios/**/studio.json + - name: Compress built assets + run: cd dist; zip -r -D ../release.zip *; cd .. + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: false + files: | + release.zip diff --git a/.github/workflows/validate_json.yml b/.github/workflows/validate_json.yml index 881a6a1..0b405ff 100644 --- a/.github/workflows/validate_json.yml +++ b/.github/workflows/validate_json.yml @@ -1,4 +1,4 @@ -name: Validate studios JSON file +name: Validate JSON files on: pull_request: diff --git a/studios.json b/studios.json deleted file mode 100644 index 40d3c03..0000000 --- a/studios.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "name": "E!", - "providers": { - "tvdb": "87", - "tmdb": "76", - "imdb": "co0022548" - }, - "artwork": { - "primary": "e", - "thumb": "e" - } - }, - { - "name": "Game Show Network", - "providers": { - "tvdb": "116", - "tmdb": "63" - }, - "artwork": { - "primary": "game-show-network", - "thumb": "game-show-network" - } - }, - { - "name": "Netflix", - "providers": { - "tvdb": "535", - "tmdb": "213", - "imdb": "co0144901", - "anidb": "54015" - }, - "artwork": { - "primary": "netflix", - "thumb": "netflix" - } - } -] \ No newline at end of file diff --git a/studios/e/studio.json b/studios/e/studio.json new file mode 100644 index 0000000..01c3fd1 --- /dev/null +++ b/studios/e/studio.json @@ -0,0 +1,15 @@ +[ + { + "name": "E!", + "machine-name": "e", + "providers": { + "tvdb": "87", + "tmdb": "76", + "imdb": "co0022548" + }, + "artwork": { + "primary": ["svg", "webp"], + "thumb": ["svg", "webp"] + } + } +] diff --git a/studios/game-show-network/studio.json b/studios/game-show-network/studio.json new file mode 100644 index 0000000..d4d0828 --- /dev/null +++ b/studios/game-show-network/studio.json @@ -0,0 +1,14 @@ +[ + { + "name": "Game Show Network", + "machine-name": "game-show-network", + "providers": { + "tvdb": "116", + "tmdb": "63" + }, + "artwork": { + "primary": ["svg", "webp"], + "thumb": ["svg", "webp"] + } + } +] diff --git a/studios/netflix/studio.json b/studios/netflix/studio.json new file mode 100644 index 0000000..5d723f3 --- /dev/null +++ b/studios/netflix/studio.json @@ -0,0 +1,16 @@ +[ + { + "name": "Netflix", + "machine-name": "netflix", + "providers": { + "tvdb": "535", + "tmdb": "213", + "imdb": "co0144901", + "anidb": "54015" + }, + "artwork": { + "primary": ["svg", "webp"], + "thumb": ["svg", "webp"] + } + } +]