Skip to content

Commit

Permalink
fix github actions (#548)
Browse files Browse the repository at this point in the history
* fix github actions

* another script

* permissions

* use env-var instead

* reposition keys

* typo

* v4.3.3pre

* v4.3.3-20240801

* tag change

* fix pipeline runs

* remove broken job

* update kotlin versions

* update kotlin versions
  • Loading branch information
thomassth authored Sep 25, 2024
1 parent b21ffc1 commit 2f1ecf6
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 48 deletions.
42 changes: 25 additions & 17 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
# Triggers the workflow on push or pull request events but only for the develop branch
push:
branches: [release, hotfix]
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand All @@ -18,33 +20,39 @@ jobs:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
permissions:
id-token: write
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
channel: "stable"
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
- run: dart --version
- run: flutter --version
- name: Get Git Tag
id: get_tag
run: echo "TAG=$(git describe --tags)" >> $GITHUB_ENV
- name: Edit pubspec.ymal for dev release
run: |
sed -i "s/version.*/&-$GITHUB_RUN_ID/" pubspec.yaml
sed -i "s/version:.*/version: ${{ env.TAG }}/" pubspec.yaml
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2.0.0
- name: Edit changelog.md for dev release
run: |
sed -i "0,/\#\# \[.*/s//## [${{steps.changelog_reader.outputs.version}}-$GITHUB_RUN_ID]/" CHANGELOG.md
sed -i "0,/\#\# \[.*/s//## [${{env.TAG}}]/" CHANGELOG.md
cat CHANGELOG.md
- name: Setup credentials
run: |
cat <<EOF > $PUB_CACHE/credentials.json
${{ secrets.CREDENTIALS }}
EOF
- name: Publish package
run: flutter pub publish --force
- name: Add entry to Github release
uses: softprops/action-gh-release@v1
# copied from https://github.com/dart-lang/setup-dart/issues/68#issuecomment-2251116730
- name: 🪪 Get Id Token
uses: actions/github-script@v6
with:
tag_name: ${{ steps.changelog_reader.outputs.version }}+${{ github.run_id }}
prerelease: true
script: |
let pub_token = await core.getIDToken('https://pub.dev')
core.exportVariable('PUB_TOKEN', pub_token)
- name: 📦 Install dependencies
run: flutter pub get
- name: 🌵 Dry Run
run: flutter pub publish --dry-run
- name: 📢 Publish
run: |
flutter pub token add https://pub.dev --env-var PUB_TOKEN
flutter pub publish -f
32 changes: 21 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
# Triggers the workflow on push or pull request events but only for the develop branch
push:
branches: [master]
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand All @@ -16,27 +18,35 @@ jobs:
release:
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
id-token: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
channel: "stable"
- uses: actions/checkout@v4
# copied from https://github.com/dart-lang/setup-dart/issues/68#issuecomment-2251116730
- uses: subosito/flutter-action@v2
- run: dart --version
- run: flutter --version
- name: Setup credentials
- name: 🪪 Get Id Token
uses: actions/github-script@v6
with:
script: |
let pub_token = await core.getIDToken('https://pub.dev')
core.exportVariable('PUB_TOKEN', pub_token)
- name: 📦 Install dependencies
run: flutter pub get
- name: 🌵 Dry Run
run: flutter pub publish --dry-run
- name: 📢 Publish
run: |
cat <<EOF > $PUB_CACHE/credentials.json
${{ secrets.CREDENTIALS }}
EOF
- name: Publish package
run: flutter pub publish --force
flutter pub token add https://pub.dev --env-var PUB_TOKEN
flutter pub publish -f
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2.0.0
- name: Add entry to Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.changelog_reader.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
body: ${{ steps.changelog_reader.outputs.changes }}
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ group 'com.builttoroam.devicecalendar'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.6.0'
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
Expand All @@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 33
compileSdkVersion 34

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
compileSdkVersion 34
ndkVersion '22.1.7171670'

sourceSets {
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.0'
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion example/lib/presentation/date_time_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class DateTimePicker extends StatelessWidget {

@override
Widget build(BuildContext context) {
final valueStyle = Theme.of(context).textTheme.headline6;
final valueStyle = Theme.of(context).textTheme.titleLarge;
return Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expand Down
11 changes: 5 additions & 6 deletions example/lib/presentation/pages/calendar_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ import 'event_reminders.dart';
enum RecurrenceRuleEndType { Indefinite, MaxOccurrences, SpecifiedEndDate }

class CalendarEventPage extends StatefulWidget {
late final Calendar _calendar;
final Calendar _calendar;
final Event? _event;
final RecurringEventDialog? _recurringEventDialog;

CalendarEventPage(this._calendar, [this._event, this._recurringEventDialog]);
const CalendarEventPage(this._calendar,
[this._event, this._recurringEventDialog]);

@override
_CalendarEventPageState createState() {
Expand Down Expand Up @@ -721,10 +722,8 @@ class _CalendarEventPageState extends State<CalendarEventPage> {
_recurrenceFrequency)
.data !=
null
? Text(_recurrenceFrequencyToText(
_recurrenceFrequency)
.data! +
' on the ')
? Text(
'${_recurrenceFrequencyToText(_recurrenceFrequency).data!} on the ')
: const Text('')),
),
Padding(
Expand Down
6 changes: 3 additions & 3 deletions example/lib/presentation/pages/calendar_events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ class _CalendarEventsPageState extends State<CalendarEventsPage> {
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Warning'),
content: SingleChildScrollView(
content: const SingleChildScrollView(
child: ListBody(
children: <Widget>[
const Text('This will delete this calendar'),
const Text('Are you sure?'),
Text('This will delete this calendar'),
Text('Are you sure?'),
],
),
),
Expand Down
4 changes: 2 additions & 2 deletions example/lib/presentation/pages/calendars.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class _CalendarsPageState extends State<CalendarsPage> {
padding: const EdgeInsets.all(10.0),
child: Text(
'WARNING: some aspects of saving events are hardcoded in this example app. As such we recommend you do not modify existing events as this may result in loss of information',
style: Theme.of(context).textTheme.headline6,
style: Theme.of(context).textTheme.titleLarge,
),
),
Expanded(
Expand Down Expand Up @@ -77,7 +77,7 @@ class _CalendarsPageState extends State<CalendarsPage> {
Text(
"${_calendars[index].id}: ${_calendars[index].name!}",
style:
Theme.of(context).textTheme.subtitle1,
Theme.of(context).textTheme.titleMedium,
),
Text(
"Account: ${_calendars[index].accountName!}"),
Expand Down
5 changes: 3 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 3.2.0
publish_to: none

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=2.12.0 <4.0.0"

dependencies:
flutter:
Expand All @@ -19,12 +19,13 @@ dependencies:
device_calendar:
path: ../

collection: ^1.18.0
dev_dependencies:
integration_test:
sdk: flutter
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
flutter_lints: ^4.0.0

# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
flutter_lints: ^4.0.0

# The following section is specific to Flutter.
flutter:
Expand All @@ -26,5 +26,5 @@ flutter:
pluginClass: DeviceCalendarPlugin

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=2.12.0 <4.0.0"
flutter: ">=1.12.13"

0 comments on commit 2f1ecf6

Please sign in to comment.