-
-
Notifications
You must be signed in to change notification settings - Fork 176
104 lines (90 loc) · 3.31 KB
/
release.yml
File metadata and controls
104 lines (90 loc) · 3.31 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
name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
permissions:
pull-requests: write
contents: write
jobs:
build:
name: Build for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: macos-latest
artifact_prefix: macos
target: x86_64-apple-darwin
- os: ubuntu-latest
artifact_prefix: linux
target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- uses: wasabeef/import-asdf-tool-versions-action@v1.0.3
id: asdf
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.asdf.outputs.flutter }}
channel: stable
cache: true
- name: Set environment
run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
- name: Prepare workspace
uses: bluefireteam/melos-action@v3
- name: Running build
run: |
cd packages/command/
mkdir -p bin/${{ matrix.target }}
dart compile exe bin/flutter_gen_command.dart -o bin/${{ matrix.target }}/fluttergen
- name: Packaging final binary
shell: bash
run: |
cd packages/command/bin/${{ matrix.target }}
tar czvf fluttergen-${{ matrix.artifact_prefix }}.tar.gz fluttergen
shasum -a 256 fluttergen-${{ matrix.artifact_prefix }}.tar.gz > fluttergen-${{ matrix.artifact_prefix }}.sha256
- name: Releasing assets
uses: softprops/action-gh-release@v2
with:
files: |
packages/command/bin/${{ matrix.target }}/fluttergen-${{ matrix.artifact_prefix }}.tar.gz
packages/command/bin/${{ matrix.target }}/fluttergen-${{ matrix.artifact_prefix }}.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: sha256-${{ strategy.job-index }}
path: packages/command/bin/${{ matrix.target }}/fluttergen-${{ matrix.artifact_prefix }}.sha256
update:
name: Update Homebrew tap
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v4.1.8
with:
pattern: sha256-*
merge-multiple: true
# GitHub Apps
- name: Generate github apps token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.FLUTTEGEN_APP_ID }}
private-key: ${{ secrets.FLUTTEGEN_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- id: version
run: echo "::set-output name=version::${GITHUB_REF##*/}"
- id: checksum
shell: bash
run: |
echo ::set-output name=sha256_linux::$(cat fluttergen-linux.sha256 | awk '{ print $1 }')
echo ::set-output name=sha256_macos::$(cat fluttergen-macos.sha256 | awk '{ print $1 }')
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ steps.app-token.outputs.token }}
repository: FlutterGen/homebrew-tap
event-type: update-tap
client-payload: '{ "sha256_linux": "${{ steps.checksum.outputs.sha256_linux }}", "sha256_macos": "${{ steps.checksum.outputs.sha256_macos }}", "version": "${{ steps.version.outputs.version }}" }'