Skip to content

Commit

Permalink
Update publish-nightly.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
StaehliJ authored Jul 25, 2023
1 parent 8059198 commit 0411455
Showing 1 changed file with 54 additions and 12 deletions.
66 changes: 54 additions & 12 deletions .github/workflows/publish-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ 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'

Expand All @@ -13,6 +18,7 @@ jobs:
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}

steps:
- uses: actions/checkout@v3
- name: print latest_commit
Expand All @@ -21,19 +27,55 @@ jobs:
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 "::set-output name=should_run::false"

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' }}
name: Publish to firebase
uses: ./.github/workflows/publish-demo.yml
with:
isSnapshot: true
secrets:
KEY_PASSWORD: ${{ secrets.DEMO_KEY_PASSWORD }}
FIREBASE_CREDENTIAL_FILE_CONTENT: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
FIREBASE_GROUP: ${{ secrets.NIGHTLY_GROUPS }}
FIREBASE_APP_ID: ${{ secrets.NIGHTLY_APP_ID }}

runs-on: ubuntu-latest
env:
DEMO_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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}"
- 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

0 comments on commit 0411455

Please sign in to comment.