mirror of
https://github.com/gotson/komga.git
synced 2026-01-04 14:52:51 +01:00
199 lines
6.4 KiB
YAML
199 lines
6.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
paths-ignore:
|
|
- 'komga-webui/src/locales/*'
|
|
push:
|
|
branches-ignore:
|
|
- 'dependabot/**'
|
|
workflow_dispatch:
|
|
inputs:
|
|
perform_release:
|
|
description: 'Perform release'
|
|
default: false
|
|
type: boolean
|
|
bump:
|
|
description: 'Bump type'
|
|
required: false
|
|
default: 'next'
|
|
type: choice
|
|
options:
|
|
- 'next'
|
|
- 'major'
|
|
- 'minor'
|
|
- 'patch'
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
name: Test JDK ${{ matrix.java }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-java@v3
|
|
with:
|
|
java-version: 19
|
|
java-package: 'jdk'
|
|
distribution: 'temurin'
|
|
- uses: actions/setup-java@v3
|
|
with:
|
|
java-version: 17
|
|
java-package: 'jdk'
|
|
distribution: 'temurin'
|
|
- name: Build
|
|
uses: gradle/gradle-build-action@v2
|
|
with:
|
|
arguments: build
|
|
- name: Upload Unit Test Results
|
|
if: always()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: test-results
|
|
path: komga/build/test-results/
|
|
- name: Upload Unit Test Reports
|
|
if: always()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: test-reports
|
|
path: komga/build/reports/tests/
|
|
|
|
webui:
|
|
runs-on: ubuntu-latest
|
|
name: Test webui builds
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '16'
|
|
cache: 'npm'
|
|
cache-dependency-path: |
|
|
package-lock.json
|
|
komga-webui/package-lock.json
|
|
- name: npm install
|
|
working-directory: komga-webui
|
|
run: npm install
|
|
- name: npm build
|
|
working-directory: komga-webui
|
|
run: npm run build
|
|
- name: npm test
|
|
working-directory: komga-webui
|
|
run: npm run test:unit
|
|
|
|
version:
|
|
runs-on: macos-latest
|
|
if: inputs.perform_release
|
|
outputs:
|
|
version_current: ${{ steps.versions.outputs.version_current }}
|
|
version_next: ${{ steps.versions.outputs.version_next }}
|
|
should_release: ${{ steps.versions.outputs.should_release }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up Homebrew
|
|
id: set-up-homebrew
|
|
uses: Homebrew/actions/setup-homebrew@master
|
|
- name: Install svu
|
|
run: brew install caarlos0/tap/svu
|
|
- name: Compute next version for release
|
|
run: |
|
|
echo "VERSION_NEXT=`svu --pattern="v[0-9]*" --strip-prefix ${{ inputs.bump }}`" | tee -a $GITHUB_ENV
|
|
echo "VERSION_NEXT_SUFFIX=`svu --pattern="v[0-9]*" --strip-prefix ${{ inputs.bump }}`" | tee -a $GITHUB_ENV
|
|
- name: Set Versions
|
|
id: versions
|
|
run: |
|
|
echo "version_current=`svu --pattern="v[0-9]*" --strip-prefix current`" >> $GITHUB_OUTPUT
|
|
echo "version_next=${{ env.VERSION_NEXT_SUFFIX }}" >> $GITHUB_OUTPUT
|
|
[[ `svu --pattern="v[0-9]*" --strip-prefix current` != ${{ env.VERSION_NEXT }} ]] && echo "should_release=true" >> $GITHUB_OUTPUT || echo
|
|
|
|
release:
|
|
name: Release
|
|
runs-on: ubuntu-latest
|
|
needs: [ test, webui, version ]
|
|
if: needs.version.outputs.should_release
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Display versions
|
|
run: |
|
|
echo "Current version: ${{ needs.version.outputs.version_current }}, should release: ${{ needs.version.outputs.version_next }}"
|
|
- name: Update version in gradle.properties
|
|
run: sed -i -e "s/version=.*/version=${{ needs.version.outputs.version_next }}/" gradle.properties
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '16'
|
|
cache: 'npm'
|
|
cache-dependency-path: |
|
|
package-lock.json
|
|
komga-webui/package-lock.json
|
|
- uses: actions/setup-java@v3
|
|
with:
|
|
java-version: '19'
|
|
java-package: 'jdk'
|
|
distribution: 'temurin'
|
|
cache: 'gradle'
|
|
- uses: actions/setup-java@v3
|
|
with:
|
|
java-version: '17'
|
|
java-package: 'jdk'
|
|
distribution: 'temurin'
|
|
cache: 'gradle'
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Build
|
|
uses: gradle/gradle-build-action@v2
|
|
with:
|
|
arguments: :komga:copyWebDist :komga:generateOpenApiDocs :komga:bootJar :komga-tray:jar
|
|
- name: Run Conveyor
|
|
uses: hydraulic-software/conveyor/actions/build@v11.1
|
|
with:
|
|
command: -f conveyor.ci.conf make site -o ./output/release
|
|
signing_key: ${{ secrets.CONVEYOR_SIGNING_KEY }}
|
|
agree_to_license: 1
|
|
env:
|
|
APPLE_ASP: ${{ secrets.APPLE_ASP }}
|
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
|
- name: Adjust Conveyor output
|
|
run: |
|
|
mkdir ./output/site
|
|
mv ./output/release/download.html ./output/site/index.html
|
|
mv ./output/release/icon.svg ./output/site/
|
|
- name: Deploy download page to Github Pages
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: ./output/site
|
|
cname: download.komga.org
|
|
- name: JReleaser full release
|
|
uses: gradle/gradle-build-action@v2
|
|
with:
|
|
arguments: jreleaserFullRelease
|
|
env:
|
|
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: JReleaser release output
|
|
if: always()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: jreleaser-release
|
|
path: |
|
|
komga/build/jreleaser/trace.log
|
|
komga/build/jreleaser/output.properties
|
|
- name: Release commit and push
|
|
uses: EndBug/add-and-commit@v9
|
|
with:
|
|
message: 'chore(release): ${{ needs.version.outputs.version_next }} [skip ci]'
|
|
default_author: github_actions
|