This repository was archived by the owner on Dec 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
139 lines (118 loc) · 4.92 KB
/
release-app.yaml
File metadata and controls
139 lines (118 loc) · 4.92 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Release App
permissions:
contents: write
on:
push:
# Cannot filter on both branches (release) and tags - it's ORed
tags:
- 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+-rc\.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+-gplay'
- 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+-rc\.[0-9]+-gplay'
jobs:
release:
name: Release Build and Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Ensure release branch
run: |
git config --global --add safe.directory '*'
if ! git branch -a --contains $(git rev-parse HEAD) | grep release >/dev/null; then
echo "Tag is not part of release branch - aborting..."
exit 1
fi
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Get Go version from Syncthing upstream
id: get_go_version
run: |
set -eu
GO_VERSION=$(grep -E '^\s*GO_VERSION:' syncthing/src/github.com/syncthing/syncthing/.github/workflows/build-syncthing.yaml | head -1 | cut -d '"' -f 2)
echo "go_version=${GO_VERSION}" >> $GITHUB_OUTPUT
echo "GO_VERSION=${GO_VERSION}" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ steps.get_go_version.outputs.go_version }}
check-latest: true
cache: false
- name: Get Android cmdline-tools version from gradle catalog
id: get_cmdline_tools_version
run: |
set -eu
CMDLINE_TOOLS_VERSION=$(grep 'android-cmdline-tools = ' gradle/libs.versions.toml | cut -d '"' -f 2)
echo "cmdline_tools_version=${CMDLINE_TOOLS_VERSION}" >> $GITHUB_OUTPUT
- name: Install Android SDK
run: |
set -eu
# Set environment variables
echo "ANDROID_HOME=$HOME/android-sdk" >> $GITHUB_ENV
echo "ANDROID_SDK_ROOT=$HOME/android-sdk" >> $GITHUB_ENV
echo "$HOME/android-sdk/cmdline-tools/latest/bin" >> $GITHUB_PATH
echo "Installing Android SDK from scratch"
# Install Android command line tools
SDK_TOOLS_VERSION="${{ steps.get_cmdline_tools_version.outputs.cmdline_tools_version }}"
SDK_TOOLS_FILE="commandlinetools-linux-${SDK_TOOLS_VERSION}_latest.zip"
mkdir -p $HOME/android-sdk/cmdline-tools
cd $HOME/android-sdk/cmdline-tools
wget -q "https://dl.google.com/android/repository/${SDK_TOOLS_FILE}"
unzip -q "${SDK_TOOLS_FILE}"
rm "${SDK_TOOLS_FILE}"
# Move to expected location
mv cmdline-tools latest
# Accept Android licenses
yes | $HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager --licenses
- name: Get app version from libs.versions.toml
id: get_version
run: |
set -eu
VERSION=$(grep 'version-name = ' gradle/libs.versions.toml | cut -d '"' -f 2)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract application ID from gradle config
id: get_app_id
run: |
set -eu
# Extract applicationId dynamically from app/build.gradle.kts using grep and cut
APPLICATION_ID=$(grep "applicationId = " app/build.gradle.kts | cut -d '"' -f 2)
echo "APPLICATION_ID=${APPLICATION_ID}" >> $GITHUB_ENV
echo "Extracted application ID: ${APPLICATION_ID}"
- name: build_release
env:
SYNCTHING_RELEASE_KEY_ALIAS: Syncthing-Fork
SIGNING_PASSWORD: '${{ secrets.SIGNING_PASSWORD }}'
SYNCTHING_RELEASE_STORE_FILE: '${{ runner.temp }}/signing-keystore.jks'
shell: bash
run: |
set -eu
unset ANDROID_NDK_HOME
echo '${{ secrets.SIGNING_KEYSTORE_JKS_BASE64 }}' | base64 -d > "$SYNCTHING_RELEASE_STORE_FILE"
java -version
./gradlew --no-daemon buildNative lintRelease assembleRelease bundlerelease
rm "$SYNCTHING_RELEASE_STORE_FILE"
- name: prepare-artifacts
shell: bash
run: |
set -eu
#
cd "app/build/outputs"
mv "bundle/release/app-release.aab" "bundle/release/${{ env.APPLICATION_ID }}_gplay_v${{ env.VERSION }}_${{ env.COMMIT_HASH }}.aab"
#
- uses: ncipollo/release-action@v1
with:
artifacts: "app/build/outputs/apk/release/*.apk,app/build/outputs/bundle/release/*.aab"
artifactErrorsFailBuild: true
name: Syncthing-Fork v${{ env.VERSION }}
bodyFile: "app/src/main/play/release-notes/en-US/default.txt"
prerelease: ${{ contains('-rc.', github.ref_name) }}
draft: true