sylviiu - schedule - 2cb9b8b644e85c1a6abda43a09236722f06f7259 #588
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ezytdl nightly distributable build | |
run-name: ${{ github.actor }} - ${{ github.event_name }} - ${{ github.sha }} | |
on: | |
schedule: | |
- cron: "0 11 * * *" # 6am cst (i'll probably be asleep and have pushed a working change by then) | |
workflow_dispatch: | |
inputs: | |
notes: | |
description: "Release notes" | |
required: false | |
default: '' | |
jobs: | |
check_date: | |
runs-on: ubuntu-latest | |
name: Check latest commit | |
outputs: | |
should_run: ${{ env.should_run }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- id: should_run | |
continue-on-error: true | |
name: check if there have been more than 0 commits since last tag | |
run: | | |
commits_since_last_tag=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count) | |
echo "$commits_since_last_tag commits since last tag" | |
echo "should_run=$(if (( $commits_since_last_tag > 0 )); then echo "true"; else echo "false"; fi)" >> "$GITHUB_ENV" | |
release_info: | |
needs: check_date | |
if: ${{ needs.check_date.outputs.should_run != 'false' }} | |
runs-on: ubuntu-latest | |
name: Create release tag | |
permissions: write-all | |
outputs: | |
release_id: ${{ steps.create_release.outputs.id }} | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get release metadata | |
id: get_release_metadata | |
run: | | |
echo "TAG_NAME=$(node -e "console.log(require('./package.json').version)")-dev.${{github.run_number}}" >> "$GITHUB_ENV" | |
echo "RELEASE_NAME=[DEV] $(node -e "console.log(require('./package.json').version)")-dev.${{github.run_number}}" >> "$GITHUB_ENV" | |
echo "BODY_PATH=$(echo "$(pwd)/release-notes.md")" >> "$GITHUB_ENV" | |
- name: Create release notes | |
id: create_notes | |
run: | | |
node devscripts/generateReleaseNotes.js nightly ${{ github.event.inputs.notes }} | |
- name: Create pre-release draft | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ env.TAG_NAME }} | |
name: ${{ env.RELEASE_NAME }} | |
commit: ${{ github.sha }} | |
draft: true | |
prerelease: true | |
makeLatest: false | |
bodyFile: ${{ env.BODY_PATH }} | |
omitBody: false | |
omitBodyDuringUpdate: true | |
linux-dist: | |
needs: release_info | |
runs-on: ubuntu-22.04 | |
permissions: write-all | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Install Node.js & NPM | |
uses: actions/setup-node@main | |
with: | |
node-version: "18" | |
- name: Install npm deps | |
run: | | |
npm install | |
- name: Build app | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm run nightly -- --build-number ${{github.run_number}} | |
macos-dist: | |
needs: release_info | |
runs-on: macos-latest | |
permissions: write-all | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Install Node.js & NPM | |
uses: actions/setup-node@main | |
with: | |
node-version: "18" | |
- name: Install npm deps | |
run: | | |
npm install | |
- name: Build app | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm run nightly -- --build-number ${{github.run_number}} | |
windows-dist: | |
needs: release_info | |
runs-on: windows-latest | |
permissions: write-all | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Install Node.js & NPM | |
uses: actions/setup-node@main | |
with: | |
node-version: "18" | |
- name: Install npm deps | |
run: | | |
npm install | |
- name: Build app | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm run nightly -- --build-number ${{github.run_number}} | |
release: | |
needs: [linux-dist, macos-dist, windows-dist, release_info] | |
name: "Release the build" | |
runs-on: "ubuntu-latest" | |
permissions: write-all | |
steps: | |
- name: Publish | |
uses: eregon/publish-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ needs.release_info.outputs.release_id }} | |
- name: Delete older nightly builds | |
uses: dev-drprasad/delete-older-releases@v0.2.1 | |
with: | |
keep_latest: 3 | |
delete_tags: true | |
delete_tag_pattern: dev | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |