Merge remote-tracking branch 'upstream/main' #221
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Halo CI | |
on: | |
pull_request: | |
branches: | |
- main | |
- release-* | |
paths: | |
- "**" | |
- "!**.md" | |
push: | |
branches: | |
- main | |
- release-* | |
paths: | |
- "**" | |
- "!**.md" | |
release: | |
types: # This configuration does not affect the page_build event above | |
- created | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
# Default steps | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
cache: 'gradle' | |
java-version: 17 | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
console: | |
- 'console/**' | |
- name: Check halo | |
run: ./gradlew check | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
- name: Analyze code | |
if: ${{ github.event_name == 'push' }} # Due to inability to access secrets during PR, only the code pushed into the branch can be analyzed. | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew sonar --info | |
- name: Setup console environment | |
if: steps.changes.outputs.console == 'true' | |
uses: halo-sigs/actions/admin-env-setup@main | |
- name: Check console | |
if: steps.changes.outputs.console == 'true' | |
run: make -C console check | |
docker-build-and-push: | |
runs-on: ubuntu-latest | |
needs: check | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: halo-sigs/actions/halo-next-docker-build@main # change the version to specific ref or release tag while the action is stable. | |
with: | |
image-name: ${{ github.event_name == 'release' && 'halo' || 'halo-dev' }} | |
ghcr-token: ${{ secrets.GHCR_TOKEN }} | |
dockerhub-user: ${{ secrets.DOCKER_USERNAME }} | |
dockerhub-token: ${{ secrets.DOCKER_TOKEN }} | |
push: ${{ github.event_name == 'push' || github.event_name == 'release' }} # we only push to GHCR if the push is to the next branch | |
console-ref: ${{ github.event_name == 'release' && github.ref || 'main' }} |