Skip to content

Commit

Permalink
ci with new pubspec
Browse files Browse the repository at this point in the history
  • Loading branch information
rtmigo committed Mar 16, 2024
1 parent 124dcda commit 2631983
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 11 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
timeout-minutes: 5

master-flag:
if: contains(github.event.head_commit.message, '!!master')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
timeout-minutes: 5

test:
timeout-minutes: 9
Expand All @@ -36,7 +38,7 @@ jobs:
sdk: [2.18.0, stable]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: dart-lang/[email protected]
with:
sdk: ${{ matrix.sdk }}
Expand All @@ -48,14 +50,15 @@ jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: dart-lang/[email protected]
- name: Install dependencies
run: dart pub get
- name: Analyze
run: dart analyze --fatal-infos
- name: Publish (dry run)
run: dart pub publish --dry-run
timeout-minutes: 5

to-staging:
needs: [test, analyze]
Expand All @@ -68,12 +71,13 @@ jobs:
type: now
target_branch: staging
github_token: ${{ github.token }}
timeout-minutes: 5

to-master:
needs: [to-staging, master-flag]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# UPDATE MASTER BRANCH

Expand All @@ -94,12 +98,13 @@ jobs:
tag_name: ${{ env.PKGVER }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
timeout-minutes: 5

to-pubdev:
needs: [to-master, release-flag]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: dart-lang/[email protected]
- name: Install dependencies
run: dart pub get
Expand All @@ -125,3 +130,4 @@ jobs:
EOF
- name: Publish package
run: dart pub publish --force
timeout-minutes: 5
127 changes: 127 additions & 0 deletions .github/workflows/ci.yml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: ci

on:
push:
branches: [dev]
paths-ignore:
- 'example/*'
- '**.md'
- '**.txt'

concurrency:
# subsequently queued workflow run will interrupt previous runs
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
release-flag:
if: contains(github.event.head_commit.message, '!!release')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

master-flag:
if: contains(github.event.head_commit.message, '!!master')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

test:
timeout-minutes: 9
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
platform: [vm, node]
sdk: [2.18.0, stable]

steps:
- uses: actions/checkout@v2
- uses: dart-lang/[email protected]
with:
sdk: ${{ matrix.sdk }}
- name: Install dependencies
run: dart pub get
- name: Run tests
run: dart test --platform ${{ matrix.platform }}

analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dart-lang/[email protected]
- name: Install dependencies
run: dart pub get
- name: Analyze
run: dart analyze --fatal-infos
- name: Publish (dry run)
run: dart pub publish --dry-run

to-staging:
needs: [test, analyze]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Merge current -> staging
uses: devmasx/[email protected]
with:
type: now
target_branch: staging
github_token: ${{ github.token }}

to-master:
needs: [to-staging, master-flag]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# UPDATE MASTER BRANCH

- name: Merge to master branch
uses: devmasx/[email protected]
with:
type: now
target_branch: master
github_token: ${{ github.token }}

# ADD GITHUB RELEASE

- name: Get version from pubspec.yaml
run: echo "PKGVER=$(sed -n "s/version://p" pubspec.yaml | xargs)" >> $GITHUB_ENV
- name: Publish GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.PKGVER }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

to-pubdev:
needs: [to-master, release-flag]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dart-lang/[email protected]
- name: Install dependencies
run: dart pub get
- name: Format
run: dart format .
- name: Test formatted
run: dart test
- name: Analyze formatted
run: dart analyze --fatal-infos

- name: Setup credentials
# data from cat ~/.pub-cache/credentials.json
run: |
mkdir -p ~/.pub-cache
cat <<EOF > ~/.pub-cache/credentials.json
{
"accessToken":"${{ secrets.PUBDEV_ACCESS_TOKEN }}",
"refreshToken":"${{ secrets.PUBDEV_REFRESH_TOKEN }}",
"tokenEndpoint":"https://accounts.google.com/o/oauth2/token",
"scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ],
"expiration": 1570721159347
}
EOF
- name: Publish package
run: dart pub publish --force
14 changes: 7 additions & 7 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: e7d5ecd604e499358c5fe35ee828c0298a320d54455e791e9dcf73486bc8d9f0
sha256: a2662fb1f114f4296cf3f5a50786a2d888268d7776cf681aa17d660ffa23b246
url: "https://pub.dev"
source: hosted
version: "14.1.0"
version: "14.0.0"
watcher:
dependency: transitive
description:
Expand All @@ -349,18 +349,18 @@ packages:
dependency: transitive
description:
name: web
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
version: "0.4.2"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
sha256: "1d8e795e2a8b3730c41b8a98a2dff2e0fb57ae6f0764a1c46ec5915387d257b2"
sha256: "939ab60734a4f8fa95feacb55804fa278de28bdeef38e616dc08e44a84adea23"
url: "https://pub.dev"
source: hosted
version: "2.4.4"
version: "2.4.3"
webkit_inspection_protocol:
dependency: transitive
description:
Expand All @@ -378,4 +378,4 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.3.0 <4.0.0"
dart: ">=3.2.0 <4.0.0"

0 comments on commit 2631983

Please sign in to comment.