Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 13 additions & 59 deletions .github/workflows/publish-to-pubdev.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,23 @@
name: Publish to Pub.dev
# .github/workflows/publish.yml
name: Publish to pub.dev

on:
push:
tags:
- 'v*.*.*' # This triggers the action for tags like v1.0.0, v2.3.4, etc.
- 'v[0-9]+.[0-9]+.[0-9]+' # tag pattern on pub.dev: 'v{{version}'

# Publish using custom workflow
jobs:
build:
publish:
permissions:
id-token: write # Required for authentication using OIDC
runs-on: ubuntu-latest

steps:
# Checkout repository
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetches all history for all tags and branches

# Set up Flutter
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.29.0' # Specify exact version instead of just 'stable'
channel: 'stable'

# Cache Flutter dependencies to speed up workflow
- name: Cache Flutter dependencies
uses: actions/cache@v3
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-pub-

# Install dependencies
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- name: Install dependencies
run: flutter pub get

# Parse the tag to get the version without 'v' prefix
- name: Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

# Verify the pubspec version matches the tag
- name: Verify version
run: |
echo "Tag version: $VERSION"
PUBSPEC_VERSION=$(grep -m 1 'version:' pubspec.yaml | awk '{print $2}')
echo "Pubspec version: $PUBSPEC_VERSION"
if [ "$VERSION" != "$PUBSPEC_VERSION" ]; then
echo "Error: The version in pubspec.yaml ($PUBSPEC_VERSION) does not match the tag version ($VERSION)"
exit 1
fi

# Publish to pub.dev
- name: Publish to Pub.dev
env:
PUB_DEV_TOKEN: ${{ secrets.PUB_DEV_TOKEN }}
run: |
# Configure Pub credentials
mkdir -p ~/.pub-cache
echo "$PUB_DEV_TOKEN" > ~/.pub-cache/credentials.json
# Publish the package
flutter pub publish --force

# Clean up after publish
- name: Clean up
run: |
rm -f ~/.pub-cache/credentials.json
# Here you can insert custom steps you need
# - run: dart tool/generate-code.dart
- name: Publish
run: flutter pub publish --force
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.1

* Minor readme update

## 0.2.0

* Updated SDK constraints to support newer Dart and Flutter versions.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You should add the following to your `pubspec.yaml` file:

```yaml
dependencies:
native_flutter_proxy: ^0.1.14
native_flutter_proxy: latest
```


Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: native_flutter_proxy
description: A flutter plugin to read and set network proxy info from native.
version: 0.2.0
version: 0.2.1
homepage: https://github.com/victorblaess/native_flutter_proxy

environment:
Expand Down