-
Notifications
You must be signed in to change notification settings - Fork 2
135 lines (133 loc) · 4.27 KB
/
deploy-main.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
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
name: Deploy a Production Release
on:
workflow_run:
workflows: [ Build ]
types:
- completed
branches: [ main ]
workflow_dispatch: {}
permissions:
contents: read
jobs:
read_version:
runs-on: ubuntu-latest
name: Get Version Number
outputs:
version: ${{ steps.read_version.outputs.version }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Download workflow artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
branch: main
allow_forks: false
- name: Copy File
run: cp ./**/version .
- name: Read Version
id: read_version
run: echo "version=$(cat version | tr -d '\r\n')" >> "$GITHUB_OUTPUT"
deploy_google:
runs-on: ubuntu-latest
name: Deploy to Google Play
needs: read_version
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Download workflow artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
branch: main
allow_forks: false
- name: Copy Files
run: cp ./**/*.aab .
- name: Upload
uses: r0adkll/[email protected]
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICES_ACCOUNT_JSON }}
packageName: app.rosy_crow
releaseFiles: app.rosy_crow-Signed.aab
releaseName: ${{ needs.read_version.outputs.version }}
track: production
status: completed
deploy_fdroid:
runs-on: ubuntu-latest
name: Deploy to F-Droid
needs: read_version
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Store SSH Key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.FDROID_REPO_SSH_KEY }}" >> ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
- name: Create Config File
run: |
cd fdroid
cp config_template.yml config.yml
chmod 0600 config.yml
echo "" >> config.yml
echo "keystorepass: ${{ secrets.ROSYCROW_SIGNING_KEY_PASSWORD }}" >> config.yml
echo "keypass: ${{ secrets.ROSYCROW_SIGNING_KEY_PASSWORD }}" >> config.yml
- name: Get the Repo Contents
run: |
mkdir -p fdroid/repo
cd fdroid/repo
echo "get -R repo/*.apk" | sftp -o StrictHostKeyChecking=no [email protected]:/var/www/rosy-crow/fdroid
- name: Download workflow artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
branch: main
allow_forks: false
- name: Copy Package into Repo
run: |
cp ./**/*.apk .
cp app.rosy_crow-Signed.apk fdroid/repo/app.rosy_crow-Signed_${{ needs.read_version.outputs.version }}.apk
- name: Install Tools
run: |
sudo add-apt-repository ppa:fdroid/fdroidserver
sudo apt-get update
sudo apt-get install fdroidserver
- name: Set Current Version and VersionCode
run: |
export VERSION_CODE=$(aapt dump badging fdroid/repo/app.rosy_crow-Signed_${{ needs.read_version.outputs.version }}.apk | sed -E -e "s/.*versionCode='([0-9]+)'.*/\1/g" | head -n 1)
echo "Version: ${{ needs.read_version.outputs.version }} VersionCode: $VERSION_CODE"
echo "" >> fdroid/metadata/app.rosy_crow.yml
echo "CurrentVersion: ${{ needs.read_version.outputs.version }}" >> fdroid/metadata/app.rosy_crow.yml
echo "CurrentVersionCode: $VERSION_CODE" >> fdroid/metadata/app.rosy_crow.yml
- name: Update F-Droid Index
run: |
cd fdroid
fdroid update -c
fdroid update
- name: Upload Repo
run: |
cd fdroid
echo "put -R repo" | sftp -o StrictHostKeyChecking=no [email protected]:/var/www/rosy-crow/fdroid
create_tag:
runs-on: ubuntu-latest
name: Tag Release
permissions: write-all
needs:
- read_version
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Create Tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # if you don't want to set write permissions use a PAT token
WITH_V: false
CUSTOM_TAG: ${{ needs.read_version.outputs.version }}