Skip to content

Build

Build #186

Workflow file for this run

# Copyright (c) 2023 Contributors to the Suwayomi project
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Build
env:
THEMES: '["wintry", "","skeleton", "crimson", "gold-nouveau", "hamlindigo", "modern", "rocket", "sahara", "seafoam", "vintage"]'
on:
workflow_dispatch:
push:
branches: ['Release']
paths-ignore:
- '**/README.md'
defaults:
run:
shell: bash
jobs:
GenTag:
outputs:
value: ${{steps.GenTagName.outputs.value}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate Tag Name
id: GenTagName
run: |
genTag="r$(git rev-list HEAD --count)"
echo "$genTag"
echo "value=$genTag" >> $GITHUB_OUTPUT
build:
needs: GenTag
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Use bun 1.1.0
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install bun dependencies
run: bun i
- run: bun run build
- run: echo "${{ needs.GenTag.outputs.value }}" > ./build/revision
- run: sed -i "s@BUILD_VERSION_PLACEHOLDER@${{ needs.GenTag.outputs.value }}@" ./build/index.html
- run: bun run build-md5
- uses: actions/upload-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}
path: |
./build/
./buildZip/md5sum
retention-days: 1
web:
needs:
- build
- GenTag
runs-on: ubuntu-latest
steps:
- name: get Build files
uses: actions/download-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}
path: ./
- name: Generate zip
working-directory: ./build
run: zip -r Suwayomi-VUI-Web-${{ needs.GenTag.outputs.value }}.zip ./*
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./build/Suwayomi-VUI-Web-${{ needs.GenTag.outputs.value }}.zip
./buildZip/md5sum
name: ${{ needs.GenTag.outputs.value }}
tag_name: ${{ needs.GenTag.outputs.value }}
body: ''
draft: false
prerelease: false
dockerBuilds:
strategy:
matrix:
theme: ${{ fromJSON( env.themes ) }}

Check failure on line 90 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / Build

Invalid workflow file

The workflow is not valid. .github/workflows/build.yml (Line: 90, Col: 16): Unrecognized named-value: 'env'. Located at position 11 within expression: fromJSON( env.themes ) .github/workflows/build.yml (Line: 90, Col: 16): Unexpected value '${{ fromJSON( env.themes ) }}'
needs:
- build
- GenTag
runs-on: ubuntu-latest
steps:
- name: get Build files
uses: actions/download-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}
path: ./
- name: Replace theme in the HTML files to generate differant theme builds
if: ${{ matrix.theme != '' }}
uses: richardrigutins/replace-in-files@v2
with:
files: '**/*.html'
search-text: data-theme='skeleton'
replacement-text: data-theme='${{ matrix.theme }}'
encoding: utf8
- name: Check out Dockerfile
uses: actions/checkout@v4
with:
sparse-checkout: |
Dockerfile
- name: get Build files
uses: actions/download-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}-${{ matrix.theme }}
path: ./
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64, linux/386, linux/ppc64le, linux/s390x
context: .
build-args: version=${{ needs.GenTag.outputs.value }}
push: false
outputs: type=docker,dest=/tmp/${{ matrix.theme }}.tar
tags: |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest${{ matrix.theme }},
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ needs.GenTag.outputs.value }}${{ matrix.theme }},
${{ github.repository_owner }}/${{ github.event.repository.name }}:latest${{ matrix.theme }},
${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ needs.GenTag.outputs.value }}${{ matrix.theme }},
- uses: actions/upload-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}-${{ matrix.theme }}
path: |
/tmp/${{ matrix.theme }}.tar
docker:
needs:
- build
- GenTag
- dockerBuilds
runs-on: ubuntu-latest
steps:
- name: get Build files
uses: actions/download-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}-*
path: ./
merge-multiple: true
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Load ad push image
run: |
for f in *.tar; do
cat $f | docker load
done
docker push -a ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
docker push -a ${{ github.repository_owner }}/${{ github.event.repository.name }}