-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (79 loc) · 3.09 KB
/
nightly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# 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 x.y.z-optional'
required: true
type: string
schedule:
- cron: '0 0 * * *'
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4
- name: Print the last commit sha
run: echo ${{ github.sha }}
- id: should_run
name: Check that the last commit was made in the last 24h
if: ${{ github.event_name == 'schedule' }}
run: >
new_commits=$(git log --since="24 hours ago" --oneline)
if [[ -n "$new_commits" ]]; then
echo "should_run=true" >> "$GITHUB_OUTPUT"
else
echo "should_run=false" >> "$GITHUB_OUTPUT"
fi
Build-nightly:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
runs-on: ubuntu-latest
env:
DEMO_KEY_PASSWORD: ${{ secrets.DEMO_KEY_PASSWORD }}
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
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: Setup VERSION_NAME from inputs
if: ${{ github.event_name == 'workflow_dispatch' }}
run: echo "VERSION_NAME=${{ inputs.version_name }}" >> "$GITHUB_ENV"
- name: Find the 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 the latest 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 "GitHub ref ${GITHUB_REF}"
echo "GitHub ref name ${GITHUB_REF_NAME}"
echo "GitHub ref type ${GITHUB_REF_TYPE}"
echo "CI ${{ env.CI }}"
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/gradle-build-action@v2
- name: Assemble nightly release
run: ./gradlew 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/nightly/release/pillarbox-demo-nightly-release.apk