Skip to content

Commit

Permalink
feat: Workflow for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
novusnota committed Sep 24, 2023
1 parent 0dc50bd commit ebe3c14
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/scripts/publish.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import 'dart:io';
import 'dart:convert' show Encoding;

main() {
var gitroot = Process.runSync(
'git',
[
'rev-parse',
'--show-toplevel',
],
stdoutEncoding: Encoding.getByName('utf-8'),
).stdout as String;

var version = File(gitroot.trim() + '/pubspec.yaml')
.readAsLinesSync()
.firstWhere((line) {
return line.contains('version:', 0);
})
.split(':')[1]
.trim();

// TODO: check the changelog for the version to be present
// TODO: create a tag if not exists: git tag v<version>
// TODO: git push origin <tag>
}
18 changes: 18 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 🚀 Publish to pub.dev

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-publish
cancel-in-progress: true

jobs:
publish:
permissions:
id-token: write
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
with:
environment: 'pub.dev'

0 comments on commit ebe3c14

Please sign in to comment.