forked from Archives/Athou_commafeed
279 lines
9.4 KiB
YAML
279 lines
9.4 KiB
YAML
name: ci
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
env:
|
|
JAVA_VERSION: 25
|
|
DOCKER_BUILD_SUMMARY: false
|
|
|
|
jobs:
|
|
build:
|
|
if: github.event_name != 'pull_request' || github.actor != 'renovate[bot]' # renovate already triggers the build on pushes
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ "ubuntu-latest", "ubuntu-22.04-arm", "windows-latest" ]
|
|
database: [ "h2", "postgresql", "mysql", "mariadb" ]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
# Checkout
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# Setup
|
|
- name: Set up GraalVM
|
|
uses: graalvm/setup-graalvm@03e8abf916fd0e281b2efe7b2da3378bb0a1d085 # v1
|
|
with:
|
|
java-version: ${{ env.JAVA_VERSION }}
|
|
distribution: "graalvm"
|
|
cache: "maven"
|
|
|
|
- name: Install Playwright dependencies
|
|
run: sudo apt-get install -y libgbm1
|
|
if: matrix.os != 'windows-latest'
|
|
|
|
# Build & Test
|
|
- name: Build with Maven
|
|
run: mvn --batch-mode --no-transfer-progress install -Pnative -P${{ matrix.database }} -DskipTests=${{ matrix.os == 'windows-latest' && matrix.database != 'h2' }}
|
|
|
|
# Build pages
|
|
- name: Create pages directory structure
|
|
run: mkdir -p target/pages/documentation/custom-css
|
|
|
|
- name: Convert readme file to html
|
|
uses: jaywcjlove/markdown-to-html-cli@cff9330af4ca8048b197a76d9eb1db189c2a7cee # v5.0.4
|
|
with:
|
|
source: README.md
|
|
output: target/pages/index.html
|
|
|
|
- name: Convert config documentation to html
|
|
uses: jaywcjlove/markdown-to-html-cli@cff9330af4ca8048b197a76d9eb1db189c2a7cee # v5.0.4
|
|
with:
|
|
source: commafeed-server/target/quarkus-generated-doc/config/commafeed-server.md
|
|
output: target/pages/documentation/index.html
|
|
|
|
- name: Convert custom css documentation to html
|
|
uses: jaywcjlove/markdown-to-html-cli@cff9330af4ca8048b197a76d9eb1db189c2a7cee # v5.0.4
|
|
with:
|
|
source: documentation/CUSTOMCSS.md
|
|
output: target/pages/documentation/custom-css/index.html
|
|
|
|
# Upload artifacts
|
|
- name: Upload cross-platform app
|
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
|
|
if: matrix.os == 'ubuntu-latest' # we only need to upload the cross-platform artifact once per database
|
|
with:
|
|
name: commafeed-${{ matrix.database }}-jvm
|
|
path: commafeed-server/target/commafeed-*.zip
|
|
|
|
- name: Upload native executable
|
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
|
|
with:
|
|
name: commafeed-${{ matrix.database }}-${{ runner.os }}-${{ runner.arch }}
|
|
path: commafeed-server/target/commafeed-*-runner*
|
|
|
|
- name: Upload pages
|
|
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
|
|
if: matrix.os == 'ubuntu-latest' && matrix.database == 'h2' # we only need to upload the pages once
|
|
with:
|
|
path: target/pages
|
|
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
env:
|
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
strategy:
|
|
matrix:
|
|
database: [ "h2", "postgresql", "mysql", "mariadb" ]
|
|
|
|
steps:
|
|
# Checkout
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# Setup
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
|
|
|
|
- name: Install required packages
|
|
run: sudo apt-get install -y rename unzip
|
|
|
|
# Prepare artifacts
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
|
with:
|
|
pattern: commafeed-${{ matrix.database }}-*
|
|
path: ./artifacts
|
|
merge-multiple: true
|
|
|
|
- name: Set the exec flag on the native executables
|
|
run: chmod +x artifacts/*-runner
|
|
|
|
- name: Rename native executables to match buildx TARGETARCH
|
|
run: |
|
|
rename 's/x86_64/amd64/g' artifacts/*
|
|
rename 's/aarch_64/arm64/g' artifacts/*
|
|
|
|
- name: Unzip jvm package
|
|
run: |
|
|
unzip artifacts/*-jvm.zip -d artifacts/extracted-jvm-package
|
|
rename 's/commafeed-.*/quarkus-app/g' artifacts/extracted-jvm-package/*
|
|
|
|
# Docker
|
|
- name: Login to Container Registry
|
|
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4
|
|
if: ${{ env.DOCKERHUB_USERNAME != '' }}
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
## build but don't push for PRs and renovate
|
|
- name: Docker build - native
|
|
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
|
|
with:
|
|
context: .
|
|
file: commafeed-server/src/main/docker/Dockerfile.native
|
|
push: false
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
|
|
- name: Docker build - jvm
|
|
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
|
|
with:
|
|
context: .
|
|
file: commafeed-server/src/main/docker/Dockerfile.jvm
|
|
push: false
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
|
|
## build and push tag
|
|
- name: Docker build and push tag - native
|
|
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
|
|
if: ${{ github.ref_type == 'tag' }}
|
|
with:
|
|
context: .
|
|
file: commafeed-server/src/main/docker/Dockerfile.native
|
|
push: ${{ env.DOCKERHUB_USERNAME != '' }}
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
tags: |
|
|
athou/commafeed:latest-${{ matrix.database }}
|
|
athou/commafeed:${{ github.ref_name }}-${{ matrix.database }}
|
|
|
|
- name: Docker build and push tag - jvm
|
|
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
|
|
if: ${{ github.ref_type == 'tag' }}
|
|
with:
|
|
context: .
|
|
file: commafeed-server/src/main/docker/Dockerfile.jvm
|
|
push: ${{ env.DOCKERHUB_USERNAME != '' }}
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
tags: |
|
|
athou/commafeed:latest-${{ matrix.database }}-jvm
|
|
athou/commafeed:${{ github.ref_name }}-${{ matrix.database }}-jvm
|
|
|
|
## build and push master
|
|
- name: Docker build and push master - native
|
|
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
|
|
if: ${{ github.ref_name == 'master' }}
|
|
with:
|
|
context: .
|
|
file: commafeed-server/src/main/docker/Dockerfile.native
|
|
push: ${{ env.DOCKERHUB_USERNAME != '' }}
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
tags: athou/commafeed:master-${{ matrix.database }}
|
|
|
|
- name: Docker build and push master - jvm
|
|
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
|
|
if: ${{ github.ref_name == 'master' }}
|
|
with:
|
|
context: .
|
|
file: commafeed-server/src/main/docker/Dockerfile.jvm
|
|
push: ${{ env.DOCKERHUB_USERNAME != '' }}
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
tags: athou/commafeed:master-${{ matrix.database }}-jvm
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build
|
|
- docker
|
|
permissions:
|
|
contents: write
|
|
if: github.ref_type == 'tag'
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
|
with:
|
|
pattern: commafeed-*
|
|
path: ./artifacts
|
|
merge-multiple: true
|
|
|
|
- name: Set the exec flag on the native executables
|
|
run: chmod +x artifacts/*-runner
|
|
|
|
- name: Extract Changelog Entry
|
|
uses: mindsers/changelog-reader-action@32aa5b4c155d76c94e4ec883a223c947b2f02656 # v2
|
|
id: changelog_reader
|
|
with:
|
|
version: ${{ github.ref_name }}
|
|
|
|
- name: Create GitHub release
|
|
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1
|
|
with:
|
|
name: CommaFeed ${{ github.ref_name }}
|
|
body: ${{ steps.changelog_reader.outputs.changes }}
|
|
artifacts: ./artifacts/*
|
|
|
|
|
|
update-dockerhub-description:
|
|
runs-on: ubuntu-latest
|
|
needs: release
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Update Docker Hub Description
|
|
uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
repository: athou/commafeed
|
|
short-description: ${{ github.event.repository.description }}
|
|
readme-filepath: commafeed-server/src/main/docker/README.md
|
|
|
|
|
|
deploy-pages:
|
|
runs-on: ubuntu-latest
|
|
needs: release
|
|
permissions:
|
|
pages: write
|
|
id-token: write
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
|
|
steps:
|
|
- uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
|
|
id: deployment
|