aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/publish.yml
blob: 8c63dc6bf5a79fd745e028e627c3e6304a76f5f0 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: citra-publish

on:
  schedule:
    - cron: '7 0 * * *'
  workflow_dispatch:
    inputs:
      nightly:
        description: 'Whether to trigger a nightly build (true/false/auto)'
        required: false
        default: 'true'
      canary:
        description: 'Whether to trigger a canary build (true/false/auto)'
        required: false
        default: 'true'

jobs:
  nightly:
    runs-on: ubuntu-latest
    if: ${{ github.event.inputs.nightly != 'false' && github.repository == 'citra-emu/citra' }}
    steps:
      # this checkout is required to make sure the GitHub Actions scripts are available
      - uses: actions/checkout@v4
        name: Pre-checkout
        with:
          submodules: false
      - uses: actions/github-script@v7
        id: check-changes
        name: 'Check for new changes'
        env:
          # 24 hours
          DETECTION_TIME_FRAME: 86400000
        with:
          result-encoding: string
          script: |
            if (context.payload.inputs && context.payload.inputs.nightly === 'true') return true;
            const checkBaseChanges = require('./.github/workflows/ci-merge.js').checkBaseChanges;
            return checkBaseChanges(github, context);
      - run: npm install execa@5
        if: ${{ steps.check-changes.outputs.result == 'true' }}
      - uses: actions/checkout@v4
        name: Checkout
        if: ${{ steps.check-changes.outputs.result == 'true' }}
        with:
          path: 'citra-merge'
          fetch-depth: 0
          submodules: true
          token: ${{ secrets.ALT_GITHUB_TOKEN }}
      - uses: actions/github-script@v7
        name: 'Update and tag new commits'
        if: ${{ steps.check-changes.outputs.result == 'true' }}
        env:
          ALT_GITHUB_TOKEN: ${{ secrets.ALT_GITHUB_TOKEN }}
        with:
          script: |
            const execa = require("execa");
            const tagAndPush = require('./.github/workflows/ci-merge.js').tagAndPush;
            process.chdir('${{ github.workspace }}/citra-merge');
            tagAndPush(github, context.repo.owner, `${context.repo.repo}-nightly`, execa);
  canary:
    runs-on: ubuntu-latest
    if: ${{ github.event.inputs.canary != 'false' && github.repository == 'citra-emu/citra' }}
    steps:
      # this checkout is required to make sure the GitHub Actions scripts are available
      - uses: actions/checkout@v4
        name: Pre-checkout
        with:
          submodules: false
      - uses: actions/github-script@v7
        id: check-changes
        name: 'Check for new changes'
        env:
          # 24 hours
          DETECTION_TIME_FRAME: 86400000
        with:
          script: |
            if (context.payload.inputs && context.payload.inputs.canary === 'true') return true;
            const checkCanaryChanges = require('./.github/workflows/ci-merge.js').checkCanaryChanges;
            return checkCanaryChanges(github, context);
      - run: npm install execa@5
        if: ${{ steps.check-changes.outputs.result == 'true' }}
      - uses: actions/checkout@v4
        name: Checkout
        if: ${{ steps.check-changes.outputs.result == 'true' }}
        with:
          path: 'citra-merge'
          fetch-depth: 0
          submodules: true
          token: ${{ secrets.ALT_GITHUB_TOKEN }}
      - uses: actions/github-script@v7
        name: 'Check and merge canary 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/ci-merge.js').mergebot;
            process.chdir('${{ github.workspace }}/citra-merge');
            mergebot(github, context, execa);