Skip to content

Publish demo nightly #121

Publish demo nightly

Publish demo nightly #121

Workflow file for this run

# Run nightly every nights at midnight or when triggered manually
# https://github.com/orgs/community/discussions/27128
name: Publish demo nightly
on:
workflow_dispatch:
inputs:
version_name:
description: 'version name as xx.yy.zz-Optional'
required: true
type: string
schedule:
- cron: '0 0 * * 1,5'
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v3
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "should_run=false" >> "$GITHUB_OUTPUT"
Build-nightly:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
runs-on: ubuntu-latest
env:
DEMO_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI: ${{ github.ci }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
- name: VERSION_NAME from inputs
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "VERSION_NAME=${{ inputs.version_name }}" >> "$GITHUB_ENV"
- name: Find latest tag
if: ${{ github.event_name != 'workflow_dispatch' }}
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: 0.0.1-alpha01 # Optional fallback tag to use when no tag can be found
- name: Setup VERSION_NAME from latest git tag
if: ${{ github.event_name != 'workflow_dispatch' }}
run: |
echo "VERSION_NAME=${{ steps.previoustag.outputs.tag }}" >> "$GITHUB_ENV"
- name: Print VersionName
run: |
echo "Version name is ${{ env.VERSION_NAME }}"
echo "ref ${GITHUB_REF}"
echo "refname ${GITHUB_REF_NAME}"
echo "refname ${GITHUB_REF_TYPE}"
echo "CI ${{ github.ci }} or ${GITHUB_CI}"
echo "Env.CI $${CI}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/[email protected]
with:
arguments: assembleNightlyRelease
- name: upload artifact to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{ secrets.NIGHTLY_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
groups: ${{ secrets.NIGHTLY_GROUPS }}
file: pillarbox-demo/build/outputs/apk/release/pillarbox-demo-nightly-release.apk