π 5.8.0 (#582) #15
Workflow file for this run
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: Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
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 | |
- uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: ${{ steps.asdf.outputs.dart }} | |
- name: Set environment | |
run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH | |
- name: Get dependencies | |
run: | | |
dart pub global activate melos | |
melos bootstrap | |
- 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 | |
path: packages/command/bin/${{ matrix.target }}/fluttergen-${{ matrix.artifact_prefix }}.sha256 | |
# - name: Setup credentials | |
# if: startsWith(matrix.os, 'ubuntu') | |
# run: | | |
# mkdir -p ~/.pub-cache | |
# cat <<eof > ~/.pub-cache/credentials.json | |
# { | |
# "accesstoken":"${{ secrets.CREDENTIALS_ACCESS_TOKEN }}", | |
# "refreshtoken":"${{ secrets.CREDENTIALS_REFRESH_TOKEN }}", | |
# "idtoken":"${{ secrets.CREDENTIALS_ID_TOKEN }}", | |
# "tokenendpoint":"https://accounts.google.com/o/oauth2/token", | |
# "scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ], | |
# "expiration": 1664440281637 | |
# } | |
# eof | |
# | |
# - name: Publish to pub.dev | |
# if: startsWith(matrix.os, 'ubuntu') | |
# run: | | |
# melos publish --no-dry-run --yes | |
update: | |
name: Update Homebrew tap | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/download-artifact@v4.1.8 | |
with: | |
name: sha256 | |
# 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 }}" }' |