-
-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (155 loc) · 5.38 KB
/
build.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
on:
push:
paths-ignore:
- '*.md'
branches:
- master
pull_request:
release:
types: [ created ]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
static_analysis:
name: Linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.0'
cache: true
- name: Run build script
id: build
run: bash ${GITHUB_WORKSPACE}/Scripts/build.sh
working-directory: Scripts
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
SKIP_BUILD: true # Checks if it exists, not the value
- name: Analyze Dart
uses: zgosalvez/github-actions-analyze-dart@v3
build_android:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
name: Build
runs-on: ${{ matrix.os }}
outputs:
SENTRY_RELEASE: ${{ steps.build.outputs.SENTRY_RELEASE }}
SENTRY_DIST: ${{ steps.build.outputs.SENTRY_DIST }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
if: matrix.os == 'ubuntu-latest'
with:
distribution: 'zulu'
java-version: '17'
cache: "gradle"
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.0'
cache: true
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
ruby-version: '3.3' # Not needed with a .ruby-version file
- name: Cocoapods Cache
uses: actions/cache@v4
id: cocoapods-cache
if: matrix.os == 'macos-latest'
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Podfile lock cache
uses: actions/cache@v4
id: cache-podfile
with:
path: ios/Podfile.lock
key: ${{ runner.os }}-pods-${{ hashFiles('pubspec.lock') }}
- name: Run build script
id: build
run: bash ${GITHUB_WORKSPACE}/Scripts/launchBuild.sh
working-directory: Scripts
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
OS: ${{ matrix.os }}
- uses: actions/upload-artifact@v4
continue-on-error: true
if: matrix.os == 'ubuntu-latest'
with:
name: artifact-${{ matrix.os }}
path: |
build/app/outputs/apk
build/app/outputs/bundle
- name: Upload Beta
if: github.event_name == 'push' && matrix.os == 'macos-latest'
run: bash ${GITHUB_WORKSPACE}/Scripts/fastlane.sh
working-directory: Scripts
continue-on-error: false
env:
VERSION: ${{ steps.build.outputs.SENTRY_RELEASE }}
BUILD_NUMBER: ${{ steps.build.outputs.SENTRY_DIST }}
GOOGLE_SECRETS: ${{ secrets.GOOGLE_PLAY }}
APPLE_SECRETS: ${{ secrets.APPLE }}
OS: ${{ matrix.os }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.FASTLANE_GITHUB }}
MATCH_PASSWORD: ${{ secrets.FASTLANE_MATCH_PASSWORD }}
- name: Upload debug symbols
run: dart pub global activate sentry_dart_plugin && dart pub global run sentry_dart_plugin
if: github.event_name == 'push' || github.event_name == 'release'
continue-on-error: true
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_URL: ${{ secrets.SENTRY_URL }}
SENTRY_RELEASE: ${{ steps.build.outputs.SENTRY_RELEASE }}
SENTRY_DIST: ${{ steps.build.outputs.SENTRY_DIST }}
release-job:
name: Releasing
needs: [ build_android ]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- uses: actions/download-artifact@v4
with:
name: Android.zip
- name: Upload release attachment
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const tag = context.ref.replace("refs/tags/", "");
// Get release for this tag
const release = await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag
});
// Upload the release asset
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: "Android.zip",
data: await fs.readFileSync("Android.zip")
});
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_URL: ${{ secrets.SENTRY_URL }}
SENTRY_DIST: ${{ needs.build_android.outputs.SENTRY_DIST }}
SENTRY_RELEASE: ${{ needs.build_android.outputs.SENTRY_RELEASE }}
with:
version: ${{ steps.read_action_js.outputs['version'] }}