|
| 1 | +name: Streamyfin Optimized Version Server CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - '*' |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + name: Lint & Test Build |
| 14 | + if: github.event_name == 'pull_request' |
| 15 | + runs-on: ubuntu-22.04 |
| 16 | + container: node:22-alpine |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + - name: Install dependencies |
| 21 | + run: npm install |
| 22 | + - name: Lint |
| 23 | + run: npm lint |
| 24 | + - name: Formatting |
| 25 | + run: npm format:check |
| 26 | + - name: Build |
| 27 | + run: npm build |
| 28 | + |
| 29 | + build_and_push: |
| 30 | + name: Build & Publish Docker Images |
| 31 | + if: github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, '[skip ci]') |
| 32 | + runs-on: ubuntu-22.04 |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v4 |
| 36 | + - name: Set up QEMU |
| 37 | + uses: docker/setup-qemu-action@v3 |
| 38 | + - name: Set up Docker Buildx |
| 39 | + uses: docker/setup-buildx-action@v3 |
| 40 | + - name: Log in to Docker Hub |
| 41 | + uses: docker/login-action@v3 |
| 42 | + with: |
| 43 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 44 | + password: ${{ secrets.DOCKER_TOKEN }} |
| 45 | + - name: Set lower case owner name |
| 46 | + run: | |
| 47 | + echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} |
| 48 | + env: |
| 49 | + OWNER: ${{ github.repository_owner }} |
| 50 | + - name: Build and push |
| 51 | + uses: docker/build-push-action@v5 |
| 52 | + with: |
| 53 | + context: . |
| 54 | + file: ./Dockerfile |
| 55 | + platforms: linux/amd64,linux/arm64 |
| 56 | + push: true |
| 57 | + tags: | |
| 58 | + fredrikburmester/streamyfin-optimized-versions-server:master |
| 59 | + discord: |
| 60 | + name: Send Discord Notification |
| 61 | + needs: build_and_push |
| 62 | + if: always() && github.event_name != 'pull_request' && !contains(github.event.head_commit.message, '[skip ci]') |
| 63 | + runs-on: ubuntu-22.04 |
| 64 | + steps: |
| 65 | + - name: Get Build Job Status |
| 66 | + uses: technote-space/workflow-conclusion-action@v3 |
| 67 | + - name: Combine Job Status |
| 68 | + id: status |
| 69 | + run: | |
| 70 | + failures=(neutral, skipped, timed_out, action_required) |
| 71 | + if [[ ${array[@]} =~ $WORKFLOW_CONCLUSION ]]; then |
| 72 | + echo "status=failure" >> $GITHUB_OUTPUT |
| 73 | + else |
| 74 | + echo "status=$WORKFLOW_CONCLUSION" >> $GITHUB_OUTPUT |
| 75 | + fi |
| 76 | + - name: Post Status to Discord |
| 77 | + uses: sarisia/actions-status-discord@v1 |
| 78 | + with: |
| 79 | + webhook: ${{ secrets.DISCORD_WEBHOOK }} |
| 80 | + status: ${{ steps.status.outputs.status }} |
| 81 | + title: ${{ github.workflow }} |
| 82 | + nofail: true |
0 commit comments