flutter pub get #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Windows | |
on: | |
push: | |
branches: [ atavism/ios-migrate-desktop ] | |
permissions: | |
contents: read | |
env: | |
GOPRIVATE: github.com/getlantern | |
S3_BUCKET: lantern | |
jobs: | |
set-version: | |
runs-on: | |
group: large-runners | |
outputs: | |
version: ${{ steps.set-version.outputs.version }} | |
prefix: ${{ steps.set-version.outputs.prefix }} | |
version_file: ${{ steps.set-version.outputs.version_file }} | |
steps: | |
- id: set-version | |
shell: python | |
run: | | |
import sys, os | |
ref = os.environ.get("GITHUB_REF","") | |
if "refs/tags/lantern" not in ref: | |
li = 'lantern-installer-dev' | |
vf = 'version-android-dev.txt' | |
version = '9999.99.99-dev' | |
else: | |
a = ref.strip().replace('refs/tags/lantern-', '') | |
parts = a.split('-',1) | |
suffix = parts[1] if len(parts)>1 else '' | |
beta = 'beta' in suffix | |
internal = 'internal' in suffix | |
if beta: | |
li = 'lantern-installer-preview' | |
vf = 'version-android-beta.txt' | |
version = parts[0] | |
elif internal: | |
li = 'lantern-installer-internal' | |
vf = 'version-android-internal.txt' | |
version = parts[0] | |
else: | |
li = 'lantern-installer' | |
vf = 'version-android.txt' | |
version = a | |
print('Setting version to ' + version) | |
print('Setting prefix to ' + li) | |
print('Setting version file to ' + vf) | |
print(f'::set-output name=version::{version}') | |
print(f'::set-output name=prefix::{li}') | |
print(f'::set-output name=version_file::{vf}') | |
build-desktop: | |
needs: set-version | |
env: | |
version: ${{ needs.set-version.outputs.version }} | |
version_file: ${{ needs.set-version.outputs.version_file }} | |
prefix: ${{ needs.set-version.outputs.prefix }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Pull LFS objects | |
run: git lfs pull | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 | |
- name: Granting private modules access | |
run: | | |
git config --global url."https://${{ secrets.GH_TOKEN }}:[email protected]/".insteadOf "https://github.com/" | |
- name: Repo access | |
run: | | |
mkdir /tmp/cache | |
echo "machine github.com login ${{ secrets.GH_TOKEN }} password x-oauth-basic" > /tmp/cache/.netrc | |
chmod 600 /tmp/cache/.netrc | |
- name: Setup Sentry CLI | |
uses: mathieu-bour/setup-sentry-cli@v1 | |
with: | |
version: latest | |
token: ${{ SECRETS.SENTRY_TOKEN }} # from GitHub secrets | |
organization: getlantern | |
project: android | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y file build-essential pkg-config | |
sudo apt-get install -y mingw-w64 nsis | |
- name: Build liblantern.dylib | |
run: | | |
CGO_ENABLED=1 CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ GOOS=windows GOARCH=386 go build -buildmode=c-shared -o desktop/liblantern.dylib desktop/lib.go | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: libgo-windows-build | |
if-no-files-found: error | |
path: | | |
desktop/liblantern.dylib | |
build-windows: | |
needs: build-desktop | |
permissions: | |
contents: "read" | |
id-token: "write" | |
env: | |
version: ${{ inputs.version }} | |
prefix: ${{ inputs.prefix }} | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
# Install Flutter | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
- run: flutter --version | |
- name: Setup protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Activate protoc-gen-dart plugin | |
run: | | |
dart pub global activate protoc_plugin | |
- name: Download the win build output | |
uses: actions/download-artifact@v3 | |
with: | |
name: libgo-windows-build | |
- name: Build Flutter app | |
run: flutter build windows | |
- name: Rename file | |
run: ren build\windows\x64\runner\Release\androidlantern.exe lantern-installer${{inputs.installer-suffix}}.exe | |
- uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: windows${{inputs.build-suffix}}-installer-unsigned | |
path: lantern-installer${{inputs.installer-suffix}}.exe | |
sign-installer: | |
needs: build-windows | |
permissions: | |
contents: "read" | |
id-token: "write" | |
env: | |
version: ${{ inputs.version }} | |
prefix: ${{ inputs.prefix }} | |
runs-on: windows-latest | |
steps: | |
- name: Download the win build output | |
uses: actions/download-artifact@v3 | |
with: | |
name: windows${{inputs.build-suffix}}-installer-unsigned | |
- name: Sign EXE with Azure Code Signing | |
uses: azure/[email protected] | |
with: | |
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }} | |
endpoint: https://wus2.codesigning.azure.net/ | |
code-signing-account-name: code-signing | |
certificate-profile-name: Lantern | |
files-folder: ${{ github.workspace }}\ | |
files-folder-filter: exe | |
file-digest: SHA256 | |
timestamp-rfc3161: http://timestamp.acs.microsoft.com | |
timestamp-digest: SHA256 | |
- name: Rename file | |
run: ren lantern-installer-unsigned.exe lantern-installer${{inputs.installer-suffix}}.exe | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: windows${{inputs.build-suffix}}-installer-signed | |
path: lantern-installer${{inputs.installer-suffix}}.exe |