Skip to content

Commit

Permalink
feat: Add Nightly Release Workflow
Browse files Browse the repository at this point in the history
This commit introduces a new workflow for nightly releases.

-   Adds a `nightly_release.yaml` workflow file to automate the creation of nightly releases.
-   The workflow runs daily at 00:00 and upon manual dispatch.
-   It checks for new commits made within the last 24 hours.
-   If new commits are found, it triggers the `mangaworld`, `animeworld`, `novelworld`, and `animeworldtv` build workflows.
-   After successful builds, it downloads the artifacts and updates the "nightly" release tag.
-   Sends a Discord notification upon deployment.
  • Loading branch information
jacobrein committed Dec 27, 2024
1 parent 2c2b3a8 commit 2ee38a5
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/nightly_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Nightly Release Workflow

on:
schedule:
- cron: '0 0 * * *' # runs daily at 00:00

workflow_dispatch:

jobs:
checkNightly:
name: Check for new commits
runs-on: ubuntu-latest
steps:
- name: Get new commits
run: echo "NEW_COMMIT_COUNT=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_ENV

mangaworld:
if: ${{ env.NEW_COMMIT_COUNT > 0 }}
uses: ./.github/workflows/mangaworld_build.yaml
secrets: inherit # pass all secrets

animeworld:
if: ${{ env.NEW_COMMIT_COUNT > 0 }}
uses: ./.github/workflows/animeworld_build.yaml
secrets: inherit # pass all secrets

animeworldtv:
if: ${{ env.NEW_COMMIT_COUNT > 0 }}
uses: ./.github/workflows/animeworldtv_build.yaml
secrets: inherit # pass all secrets

novelworld:
if: ${{ env.NEW_COMMIT_COUNT > 0 }}
uses: ./.github/workflows/novelworld_build.yaml
secrets: inherit # pass all secrets



release:
name: Release APK
needs: [ mangaworld, animeworld, novelworld, animeworldtv ]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:

- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts

- name: Get tag name
id: get_tag_name
run: |
set -x
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Update Nightly Release
uses: andelf/nightly-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
name: 'OtakuWorld Nightly Release'
prerelease: true
body: 'Nightly release of OtakuWorld.'
files: |
${{ github.workspace }}/release-artifacts/**
# - name: Create Nightly Release
# id: create_release
# uses: softprops/action-gh-release@v2
# if: startsWith(github.ref, 'refs/tags/')
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# fail_on_unmatched_files: true
# tag_name: ${{ env.VERSION_TAG }}
# name: Release ${{ env.VERSION_TAG }}
# files: |
# ${{ github.workspace }}/release-artifacts/**

- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: 'Nightly Release of the project {{ EVENT_PAYLOAD.repository.full_name }} has been deployed.'

0 comments on commit 2ee38a5

Please sign in to comment.