Skip to content

Commit

Permalink
Use github token if it exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzybinary committed Oct 14, 2024
1 parent bd88904 commit f22de56
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
- name: Fetch latest dart_shared_library
run: |
dart ./tools/fetch_dart/bin/fetch_dart.dart --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build Shared Library
run: |
cmake -DCMAKE_BUILD_TYPE=Release . -B "build"
Expand All @@ -50,9 +52,17 @@ jobs:
continue-on-error: false
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- uses: actions/download-artifact@v3
with:
path: artifacts
- run: dart pub get
working-directory: ./tools/fetch_dart
- name: Fetch latest dart_shared_library
run: |
dart ./tools/fetch_dart/bin/fetch_dart.dart --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Create extension"
run: |
mkdir -p out/extension
Expand Down
8 changes: 6 additions & 2 deletions tools/fetch_dart/bin/fetch_dart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:path/path.dart' as path;

final destDir = Directory('src/dart_dll');
final destBinDir = Directory(path.join(destDir.path, 'bin/release'));
final destIncludeDir = Directory(path.join(destDir.path, 'bin/release'));
final destIncludeDir = Directory(path.join(destDir.path, 'include'));

ArgParser buildParser() {
return ArgParser()
Expand Down Expand Up @@ -138,7 +138,11 @@ void _fetchLocal(String localPath, Logger l) async {
}

void _fetchFromGithub(String? version, Logger l) async {
final github = GitHub();
final authToken = Platform.environment['GITHUB_TOKEN'];
final auth = authToken == null
? Authentication.anonymous()
: Authentication.withToken(authToken);
final github = GitHub(auth: auth);
final repoSlug = RepositorySlug('fuzzybinary', 'dart_shared_library');

final Release downloadRelease;
Expand Down

0 comments on commit f22de56

Please sign in to comment.