This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
146 lines (137 loc) · 5.86 KB
/
release_draft_github_release.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
name: Draft Github Release
on:
# Enable manual run
workflow_dispatch:
inputs:
version:
description: "Tag to create (e.g. v2.10.0). Must include 'v' and must match pubspec"
required: true
default: "v2.10.0"
type: string
# Declare default permissions as read only.
permissions: read-all
jobs:
draft-release:
name: Draft Github release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Draft release with release notes
id: create_release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
env:
GITHUB_TOKEN: ${{ secrets.FLUTTERGALLERYRELEASEBOT_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version }}
draft: true
prerelease: false
generate_release_notes: true
create-build:
name: Create ${{ matrix.target }} build
runs-on: ${{ matrix.os }}
strategy:
matrix:
target: [macOS, Windows, Linux, Android]
include:
- os: macos-latest
target: macOS
build_target: macos
build_path: build/macos/Build/Products/Release
asset_extension: .zip
asset_content_type: application/zip
- os: windows-latest
target: Windows
build_target: windows
build_path: build\windows\runner\Release
asset_extension: .zip
asset_content_type: application/zip
- os: ubuntu-latest
target: Linux
build_target: linux
build_path: build/linux/x64/release/bundle
asset_extension: .tar.gz
asset_content_type: application/gzip
- os: ubuntu-latest
target: Android
build_target: apk
build_path: build/app/outputs/flutter-apk
asset_extension: .apk
asset_content_type: application/vnd.android.package-archive
# Disable fail-fast as we want results from all even if one fails.
fail-fast: false
needs: draft-release
steps:
# Set up Flutter.
- name: Clone Flutter repository with master channel
uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: master
- name: Install Linux dependencies
if: matrix.target == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libx11-dev pkg-config cmake ninja-build libblkid-dev
- name: Install Android dependencies
if: matrix.target == 'Android'
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
java-version: "12.x"
distribution: temurin
- run: flutter doctor -v
# Checkout gallery code, recreate missing files, and get packages.
- name: Checkout gallery code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- run: flutter create .
- run: flutter pub get
- name: Configure Keystore for Android
if: matrix.target == 'Android'
run: |
echo "$PLAY_STORE_UPLOAD_KEY" | base64 --decode > app/upload-keystore.jks
echo "storeFile=upload-keystore.jks" >> key.properties
echo "keyAlias=$KEYSTORE_KEY_ALIAS" >> key.properties
echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> key.properties
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> key.properties
env:
PLAY_STORE_UPLOAD_KEY: ${{ secrets.PLAY_STORE_UPLOAD_KEY }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
working-directory: android
# Build the application.
- run: flutter build -v ${{ matrix.build_target }} --release
# Package the build.
- name: Copy VC redistributables to release directory for Windows
if: matrix.target == 'Windows'
run: |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140_1.dll') .
working-directory: ${{ matrix.build_path }}
- name: Rename build for Android
if: matrix.target == 'Android'
run: mv app-release.apk $GITHUB_WORKSPACE/flutter_gallery_${{ matrix.target }}.apk
working-directory: ${{ matrix.build_path }}
- name: Compress build for Linux
if: matrix.target == 'Linux'
run: tar czf $GITHUB_WORKSPACE/flutter_gallery_${{ matrix.target }}.tar.gz *
working-directory: ${{ matrix.build_path }}
- name: Compress build for macOS
if: matrix.target == 'macOS'
run: ditto -c -k --sequesterRsrc --keepParent Flutter\ Gallery.app $GITHUB_WORKSPACE/flutter_gallery_${{ matrix.target }}.zip
working-directory: ${{ matrix.build_path }}
- name: Compress build for Windows
if: matrix.target == 'Windows'
run: compress-archive -Path * -DestinationPath ${env:GITHUB_WORKSPACE}\flutter_gallery_${{ matrix.target }}.zip
working-directory: ${{ matrix.build_path }}
# Upload the build.
- name: Add packaged build to release draft
id: upload_release_asset
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5
env:
GITHUB_TOKEN: ${{ secrets.FLUTTERGALLERYRELEASEBOT_TOKEN }}
with:
upload_url: ${{ needs.draft-release.outputs.upload_url }}
asset_path: ./flutter_gallery_${{ matrix.target }}${{ matrix.asset_extension }}
asset_name: flutter_gallery_${{ matrix.target }}${{ matrix.asset_extension }}
asset_content_type: ${{ matrix.asset_content_type }}