Skip to content

Nightly Release Workflow #3

Nightly Release Workflow

Nightly Release Workflow #3

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: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to count the commits
- name: Get new commits
run: echo "NEW_COMMIT_COUNT=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_ENV
mangaworld:
needs: checkNightly
if: ${{ env.NEW_COMMIT_COUNT > 0 }}

Check failure on line 23 in .github/workflows/nightly_release.yaml

View workflow run for this annotation

GitHub Actions / Nightly Release Workflow

Invalid workflow file

The workflow is not valid. .github/workflows/nightly_release.yaml (Line: 23, Col: 9): Unrecognized named-value: 'env'. Located at position 1 within expression: env.NEW_COMMIT_COUNT > 0 .github/workflows/nightly_release.yaml (Line: 29, Col: 9): Unrecognized named-value: 'env'. Located at position 1 within expression: env.NEW_COMMIT_COUNT > 0
uses: ./.github/workflows/mangaworld_build.yaml
secrets: inherit # pass all secrets
animeworld:
needs: checkNightly
if: ${{ env.NEW_COMMIT_COUNT > 0 }}
uses: ./.github/workflows/animeworld_build.yaml
secrets: inherit # pass all secrets
animeworldtv:
needs: checkNightly
if: ${{ env.NEW_COMMIT_COUNT > 0 }}
uses: ./.github/workflows/animeworldtv_build.yaml
secrets: inherit # pass all secrets
novelworld:
needs: checkNightly
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: ${{ env.NEW_COMMIT_COUNT > 0 }}
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.'