Skip to content

Commit

Permalink
chore: fix GH action to publish (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-skolnick authored Sep 19, 2023
1 parent 1272b4a commit a0a1f78
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ on:

jobs:
publish:
permissions:
id-token: write # required for authentication using OIDC to publish to pub.dev

runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- uses: actions/checkout@v3

- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ env.dart_version }}
Expand All @@ -31,4 +35,10 @@ jobs:
uses: codecov/codecov-action@v3

- name: Publish to pub.dev
uses: dart pub publish
run: dart pub publish

- name: Create tag
run: |
version=v$(dart run tool/get_version.dart)
git tag $version
git push origin $version
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.2.0

- fix publishing

# 0.1.0

- initial release
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: changelog_bubbler
version: 0.1.0
version: 0.2.0
description: Compiles changelogs from this package and every sub-package (between specified refs)
repository: https://github.com/m-skolnick/changelog_bubbler.dart
environment:
Expand Down
11 changes: 11 additions & 0 deletions tool/get_version.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'dart:io';

import 'package:pubspec_parse/pubspec_parse.dart';

Future<void> main(List<String> args) async {
final pubspecStr = File('pubspec.yaml').readAsStringSync();
final pubspec = Pubspec.parse(pubspecStr);
final packageVersion = pubspec.version.toString();

print(packageVersion);
}

0 comments on commit a0a1f78

Please sign in to comment.