summaryrefslogtreecommitdiffstats
path: root/.github/workflows/android-publish.yml
blob: 68e21c2f221d50ac0caf40cf65d71869675a64e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# SPDX-FileCopyrightText: 2023 yuzu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later

name: yuzu-android-publish

on:
  schedule:
    - cron: '37 0 * * *'
  workflow_dispatch:
    inputs:
      android:
        description: 'Whether to trigger an Android build (true/false/auto)'
        required: false
        default: 'true'

jobs:
  android:
    runs-on: ubuntu-latest
    if: ${{ github.event.inputs.android != 'false' && github.repository == 'yuzu-emu/yuzu-android' }}
    steps:
      # this checkout is required to make sure the GitHub Actions scripts are available
      - uses: actions/checkout@v3
        name: Pre-checkout
        with:
          submodules: false
      - uses: actions/github-script@v6
        id: check-changes
        name: 'Check for new changes'
        env:
          # 24 hours
          DETECTION_TIME_FRAME: 86400000
        with:
          script: |
            if (context.payload.inputs && context.payload.inputs.android === 'true') return true;
            const checkAndroidChanges = require('./.github/workflows/android-merge.js').checkAndroidChanges;
            return checkAndroidChanges(github);
      - run: npm install execa@5
        if: ${{ steps.check-changes.outputs.result == 'true' }}
      - uses: actions/checkout@v3
        name: Checkout
        if: ${{ steps.check-changes.outputs.result == 'true' }}
        with:
          path: 'yuzu-merge'
          fetch-depth: 0
          submodules: true
          token: ${{ secrets.ALT_GITHUB_TOKEN }}
      - uses: actions/github-script@v5
        name: 'Check and merge Android changes'
        if: ${{ steps.check-changes.outputs.result == 'true' }}
        env:
          ALT_GITHUB_TOKEN: ${{ secrets.ALT_GITHUB_TOKEN }}
        with:
          script: |
            const execa = require("execa");
            const mergebot = require('./.github/workflows/android-merge.js').mergebot;
            process.chdir('${{ github.workspace }}/yuzu-merge');
            mergebot(github, context, execa);