|
|
|
name: Overseerr CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- '*'
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- develop
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
name: Lint & Test Build
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
container: node:16.17-alpine
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install dependencies
|
|
|
|
env:
|
|
|
|
HUSKY: 0
|
|
|
|
run: yarn
|
|
|
|
- name: Lint
|
|
|
|
run: yarn lint
|
|
|
|
- name: Formatting
|
|
|
|
run: yarn format:check
|
|
|
|
- name: Build
|
|
|
|
run: yarn build
|
|
|
|
|
|
|
|
build_and_push:
|
|
|
|
name: Build & Publish Docker Images
|
|
|
|
if: github.ref == 'refs/heads/develop' && !contains(github.event.head_commit.message, '[skip ci]')
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Log in to Docker Hub
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: ./Dockerfile
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
|
|
push: true
|
|
|
|
build-args: |
|
|
|
|
COMMIT_TAG=${{ github.sha }}
|
|
|
|
tags: |
|
|
|
|
sctx/overseerr:develop
|
|
|
|
sctx/overseerr:${{ github.sha }}
|
|
|
|
ghcr.io/sct/overseerr:develop
|
|
|
|
ghcr.io/sct/overseerr:${{ github.sha }}
|
|
|
|
|
|
|
|
discord:
|
|
|
|
name: Send Discord Notification
|
|
|
|
needs: build_and_push
|
|
|
|
if: always() && github.event_name != 'pull_request' && !contains(github.event.head_commit.message, '[skip ci]')
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Get Build Job Status
|
|
|
|
uses: technote-space/workflow-conclusion-action@v3
|
|
|
|
- name: Combine Job Status
|
|
|
|
id: status
|
|
|
|
run: |
|
|
|
|
failures=(neutral, skipped, timed_out, action_required)
|
|
|
|
if [[ ${array[@]} =~ $WORKFLOW_CONCLUSION ]]; then
|
|
|
|
echo "status=failure" >> $GITHUB_OUTPUT
|
|
|
|
else
|
|
|
|
echo "status=$WORKFLOW_CONCLUSION" >> $GITHUB_OUTPUT
|
|
|
|
fi
|
|
|
|
- name: Post Status to Discord
|
|
|
|
uses: sarisia/actions-status-discord@v1
|
|
|
|
with:
|
|
|
|
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
|
|
|
status: ${{ steps.status.outputs.status }}
|
|
|
|
title: ${{ github.workflow }}
|
|
|
|
nofail: true
|