mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-27 09:32:30 -06:00
45ea8340be
... on the GitHub Actions. This will remove the reliance on the backend server merging script and more transparent to the other contributors
99 lines
3.6 KiB
YAML
99 lines
3.6 KiB
YAML
name: citra-publish
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '7 0 * * *'
|
|
workflow_dispatch:
|
|
inputs:
|
|
nightly:
|
|
description: 'Whether trigger a nightly build (true/false/auto)'
|
|
required: false
|
|
default: 'true'
|
|
canary:
|
|
description: 'Whether trigger a canary build (true/false/auto)'
|
|
required: false
|
|
default: 'true'
|
|
|
|
jobs:
|
|
nightly:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event.inputs.nightly != 'false' }}
|
|
steps:
|
|
- uses: actions/github-script@v5
|
|
id: check-changes
|
|
name: 'Check for new changes'
|
|
with:
|
|
result-encoding: string
|
|
script: |
|
|
if (context.payload.inputs && context.payload.inputs.nightly === 'true') return true;
|
|
const delta = new Date() - new Date(context.payload.repository.pushed_at);
|
|
if (delta <= 86400000) {
|
|
return true;
|
|
}
|
|
console.log('No new changes detected.');
|
|
return false;
|
|
# this checkout is required to make sure the GitHub Actions scripts are available
|
|
- uses: actions/checkout@v2
|
|
if: ${{ steps.check-changes.outputs.result == 'true' }}
|
|
name: Pre-checkout
|
|
with:
|
|
submodules: false
|
|
- run: npm install execa@5
|
|
if: ${{ steps.check-changes.outputs.result == 'true' }}
|
|
- uses: actions/checkout@v2
|
|
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@v5
|
|
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' }}
|
|
steps:
|
|
# this checkout is required to make sure the GitHub Actions scripts are available
|
|
- uses: actions/checkout@v2
|
|
name: Pre-checkout
|
|
with:
|
|
submodules: false
|
|
- uses: actions/github-script@v5
|
|
id: check-changes
|
|
name: 'Check for new changes'
|
|
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@v2
|
|
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@v5
|
|
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);
|