Skip to content

Commit 9b15377

Browse files
committed
Attempt nightly deploy
1 parent e40291c commit 9b15377

File tree

3 files changed

+97
-31
lines changed

3 files changed

+97
-31
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
push:
3+
tags:
4+
- "*-nightly"
5+
6+
name: Create Nightly
7+
8+
concurrency:
9+
group: nightly
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build:
14+
name: Create Nightly
15+
runs-on: ubuntu-latest
16+
environment: nightly
17+
permissions:
18+
contents: write
19+
steps:
20+
- name: Checkout code
21+
uses: actions/[email protected]
22+
- name: Set up Ruby
23+
uses: ruby/setup-ruby@v1
24+
with:
25+
bundler-cache: true
26+
- name: Set up Java
27+
uses: actions/[email protected]
28+
with:
29+
distribution: "zulu"
30+
java-version: "21"
31+
- name: Build APK
32+
env:
33+
ENCODED_GOOGLE_SERVICES: ${{ secrets.ENCODED_GOOGLE_SERVICES }}
34+
ENCODED_RELEASE_KEYSTORE: ${{ secrets.ENCODED_RELEASE_KEYSTORE }}
35+
ENCODED_SECRETS_PROPERTIES: ${{ secrets.ENCODED_SECRETS_PROPERTIES }}
36+
run: make deploy-free-nightly
37+
- name: Create Nightly
38+
uses: softprops/action-gh-release@v2
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
generate_release_notes: true
43+
draft: false
44+
prerelease: true
45+
files: |
46+
app/build/outputs/apk/free/release/app-free-nightly.apk

.github/workflows/create-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ on:
22
push:
33
tags:
44
- "*"
5+
- "!*-nightly"
56

67
name: Create Release
78

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,65 @@
11
on:
2-
# schedule:
3-
# - cron: "0 6 * * *"
4-
workflow_dispatch
2+
workflow_dispatch:
3+
schedule:
4+
- cron: "0 6 * * *" # UTC
55

6-
name: Nightly
6+
name: Deploy Nightly
77

88
concurrency:
99
group: nightly
1010
cancel-in-progress: true
1111

1212
jobs:
13-
build:
14-
name: Create Release
13+
check-and-deploy:
14+
name: Check Changes and Deploy Nightly
1515
runs-on: ubuntu-latest
16-
environment: nightly
1716
permissions:
1817
contents: write
1918
steps:
2019
- name: Checkout code
2120
uses: actions/[email protected]
22-
- name: Set up Ruby
23-
uses: ruby/setup-ruby@v1
2421
with:
25-
bundler-cache: true
26-
- name: Set up Java
27-
uses: actions/[email protected]
28-
with:
29-
distribution: "zulu"
30-
java-version: "21"
31-
- name: Build APK
32-
env:
33-
ENCODED_GOOGLE_SERVICES: ${{ secrets.ENCODED_GOOGLE_SERVICES }}
34-
ENCODED_RELEASE_KEYSTORE: ${{ secrets.ENCODED_RELEASE_KEYSTORE }}
35-
ENCODED_SECRETS_PROPERTIES: ${{ secrets.ENCODED_SECRETS_PROPERTIES }}
36-
run: make deploy-free-nightly
37-
- name: Create Release
38-
uses: softprops/action-gh-release@v2
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
with:
42-
generate_release_notes: true
43-
draft: false
44-
prerelease: true
45-
files: |
46-
app/build/outputs/apk/free/release/app-free-nightly.apk
22+
fetch-depth: 0
23+
24+
- name: Get latest nightly tag
25+
id: latest-nightly
26+
run: |
27+
LATEST_NIGHTLY=$(git tag -l "*-nightly" --sort=-version:refname | head -n 1)
28+
echo "latest_nightly=${LATEST_NIGHTLY}" >> $GITHUB_OUTPUT
29+
echo "Latest nightly tag: ${LATEST_NIGHTLY}"
30+
31+
- name: Check for changes since last nightly
32+
id: check-changes
33+
run: |
34+
LATEST_NIGHTLY="${{ steps.latest-nightly.outputs.latest_nightly }}"
35+
36+
if [ -z "$LATEST_NIGHTLY" ]; then
37+
echo "No previous nightly tag found, proceeding with deployment"
38+
echo "has_changes=true" >> $GITHUB_OUTPUT
39+
else
40+
# Check if there are any commits since the last nightly tag
41+
COMMITS_SINCE=$(git rev-list --count ${LATEST_NIGHTLY}..HEAD)
42+
echo "Commits since ${LATEST_NIGHTLY}: ${COMMITS_SINCE}"
43+
44+
if [ "$COMMITS_SINCE" -eq "0" ]; then
45+
echo "No changes since last nightly tag"
46+
echo "has_changes=false" >> $GITHUB_OUTPUT
47+
else
48+
echo "Found ${COMMITS_SINCE} commits since last nightly tag"
49+
echo "has_changes=true" >> $GITHUB_OUTPUT
50+
fi
51+
fi
52+
53+
- name: Exit if no changes
54+
if: steps.check-changes.outputs.has_changes == 'false'
55+
run: |
56+
echo "No changes detected since last nightly tag. Exiting without creating new nightly."
57+
exit 0
58+
59+
- name: Create nightly tag
60+
if: steps.check-changes.outputs.has_changes == 'true'
61+
run: |
62+
NIGHTLY_TAG="$(date +'%Y.%m.%d')-nightly"
63+
echo "Creating nightly tag: ${NIGHTLY_TAG}"
64+
git tag "${NIGHTLY_TAG}"
65+
git push origin ${NIGHTLY_TAG}

0 commit comments

Comments
 (0)