k-paxian / dart-package-publisher Goto Github PK
View Code? Open in Web Editor NEWAction to Publish Dart / Flutter Package To https://pub.dev When you need to publish a package, just bump the version in pubspec.yaml
License: MIT License
Action to Publish Dart / Flutter Package To https://pub.dev When you need to publish a package, just bump the version in pubspec.yaml
License: MIT License
When pubspec.yaml
has flutter
in the environment section AND flutter: true
input was not given in the workflow definition
...
environment:
sdk: '>=2.6.1 <3.0.0'
flutter: '>=1.17.0'
...
publishing is failing π΄ with the console output
Check inputs...
Missing credentialJson, trying tokens
OK
Switching to package directory 'flutter.package'
Package dir: /github/workspace/flutter.package
Because test_flutter_package requires the Flutter SDK, version solving failed.
Flutter users should run `flutter pub get` instead of `dart pub get`.
Because test_flutter_package requires the Flutter SDK, version solving failed.
Flutter users should run `flutter pub get` instead of `dart pub get`.
The reason is described here
Hello @k-paxian, could you add support for hosted packages which take a token for authentication. This could be an additional parameter. Currently it fails with the following errors:
https://dart.pkg.jetbrains.space/vyuh/p/main/vyuh/ package repository requested authentication!
You can provide credentials using:
flutter pub token add https://dart.pkg.jetbrains.space/vyuh/p/main/vyuh/
Authentication failed!
For the check for remote version, it does not consider the fact that the package is hosted and does a global activation using pub.dev, as seen below:
Because pub global activate depends on vyuh_analytics_provider_firebase any which doesn't exist (could not find package vyuh_analytics_provider_firebase at https://pub.dev),/ version solving failed.
Notice: Local version: [1.0.0]
Notice: Remote version: [β]
I have some packages which depends dev
channel of flutter, I find the flutter channel of this github action was hardcoded, is there any options for config the flutter channel.
While publishing the package to the pub.dev, the dry-runs successfully. But when trying to publishing the package, it returns a link that says to 'In the web browser paste the link and click on Allow access', When pasted the link in a web browser, it returns unable to connect.
Tried by
Attaching the screenshot below.
Appreciate any help that unblocks me. Thank you.
Hi,
I am trying to automate the publishing of a flutter package for which i added the access token and refresh token in the secrets. But i am still getting the error stating missing access token ?
https://github.com/qssq/smart_grid_pageview/runs/5432832386?check_suite_focus=true
/usr/bin/docker run --name a95e9a5[13](https://github.com/qssq/smart_grid_pageview/runs/5432832386?check_suite_focus=true#step:7:13)2a0aa7b4a0cb9acf939[15](https://github.com/qssq/smart_grid_pageview/runs/5432832386?check_suite_focus=true#step:7:15)9[17](https://github.com/qssq/smart_grid_pageview/runs/5432832386?check_suite_focus=true#step:7:17)032_2a1[24](https://github.com/qssq/smart_grid_pageview/runs/5432832386?check_suite_focus=true#step:7:24)4 --label 29a95e --workdir /github/workspace --rm -e FLUTTER_ROOT -e PUB_CACHE -e INPUT_ACCESSTOKEN -e INPUT_REFRESHTOKEN -e INPUT_CREDENTIALJSON -e INPUT_RELATIVEPATH -e INPUT_DRYRUNONLY -e INPUT_SKIPTESTS -e INPUT_SUPPRESSBUILDRUNNER -e INPUT_FORMAT -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/smart_grid_pageview/smart_grid_pageview":"/github/workspace" 29a95e:9a5132a0aa7b4a0cb9acf93915917032
Check inputs...
Missing credentialJson, trying tokens
OK
Package dir: /github/workspace
Because smart_gridded_pageview requires the Flutter SDK, version solving failed.
Flutter users should run `flutter pub get` instead of `dart pub get`.
Because smart_gridded_pageview requires the Flutter SDK, version solving failed.
Flutter users should run `flutter pub get` instead of `dart pub get`.
Could not find a file named "pubspec.yaml" in "/opt/hostedtoolcache/flutter/2.10.2-stable/x64/.pub-cache/hosted/pub.dartlang.org/async-2.8.2".
No package found. :(
When we use flutter
in the action, jobs will report flutter
as an unexpected input.
Warning: Unexpected input(s) 'flutter', valid inputs are ['entryPoint', 'args', 'accessToken', 'refreshToken', 'credentialJson', 'relativePath', 'dryRunOnly', 'skipTests', 'suppressBuildRunner', 'format']
Hi,
would it be possible to add an option to run the dart doc
command, to generate package documentation before publishing?
Thanks.
The job failed, but the status report was successful, which would mislead our judgment.
Thanks for this package! It is going to save lot of time for me π. I have a request to add a config variable to skip the build_runner
tests and instead only do pub run test
. The specific piece of code that needs change is below:
run_unit_tests() {
if [ "$INPUT_SKIPTESTS" = "true" ]; then
echo "Skip unit tests set to true, skip unit testing."
else
if [ "$HAS_BUILD_RUNNER" != "" ] && [ "$HAS_BUILD_TEST" != "" ]; then
echo "build_runner: $HAS_BUILD_RUNNER"
echo "build_test: $HAS_BUILD_TEST"
pub run build_runner test
else
if [ "$HAS_TEST" != "" ]; then
pub run test
else
echo "No unit test related dependencies detected, skip unit testing."
fi
fi
fi
}
...specifically if [ "$HAS_BUILD_RUNNER" != "" ] && [ "$HAS_BUILD_TEST" != "" ];
. You are checking if the build_runner
and build_test
packages are present and deciding to run the pub run build_runner test
.
Can we have an option where we only do build_runner test
if explicitly specified. Say with a config input like checkBuildRunner
? Only if this input is set should you execute the build_runner test
, else do the pub run test
?
Let me know if this sounds reasonable.
When dryRunOnly: true
and the publishing fails, the job doesn't fail. I would expect it to fail.
My usecase is to dry run the publish job for the pull request and if everything is fine merge it on main
and have it actually published.
Hi, we are a verified publisher https://pub.dev/packages/m3o yet we are facing problem publishing our package automatically using this GitHub action.
Any idea what we can do to fix this issue, currently we are publishing our package manually.
below is the latest logs, you can see it is setting there waiting for an action from our side.
https://github.com/m3o/m3o-dart/runs/6195174158?check_suite_focus=true#step:9:194
and this is the workflow publish.yml
https://github.com/m3o/m3o-dart/blob/main/.github/workflows/publish.yml
Please use the official docker image for dart:https://hub.docker.com/_/dart?tab=description, instead of the google/dart, which has been deprecated.
Just fixed my end of misconfig, but the action should return error status when No package found. :(
.
See logs: https://github.com/TinyCommunity/tinycolor2/runs/5516122037
This is my workflow file:
name: Publish to Pub.dev
on:
push:
branches: [ Yeikel200-patch-1 ]
jobs:
publishing:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v2 # required!
- name: 'ir_sensor_plugin'
uses: k-paxian/dart-package-publisher@master
with:
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
credentialJson: ${{ secrets.CREDENTIAL_JSON }}
dryRunOnly: true
This is the LOG:
2020-06-12T17:55:26.6931792Z commit 37389951ae792fc3777dd9e0c70ed16f4cebac35
2020-06-12T17:55:26.6932520Z Author: Yeikel Uriarte Arteaga <[email protected]>
2020-06-12T17:55:26.6933122Z Date: Fri Jun 12 13:52:17 2020 -0500
2020-06-12T17:55:26.6933218Z
2020-06-12T17:55:26.6933423Z Add credentialJson
2020-06-12T17:55:26.7058277Z ##[group]Run k-paxian/dart-package-publisher@master
2020-06-12T17:55:26.7058481Z with:
2020-06-12T17:55:26.7059199Z accessToken: ***
2020-06-12T17:55:26.7060498Z refreshToken: ***
2020-06-12T17:55:26.7061709Z credentialJson: ***
2020-06-12T17:55:26.7061906Z dryRunOnly: true
2020-06-12T17:55:26.7062083Z skipTests: false
2020-06-12T17:55:26.7062719Z suppressBuildRunner: false
2020-06-12T17:55:26.7063280Z ##[endgroup]
2020-06-12T17:55:26.7091554Z ##[command]/usr/bin/docker run --name d3b1bc312edeed4d45b6d7826ee60b428c_5bff95 --label 3888d3 --workdir /github/workspace --rm -e INPUT_ACCESSTOKEN -e INPUT_REFRESHTOKEN -e INPUT_CREDENTIALJSON -e INPUT_DRYRUNONLY -e INPUT_RELATIVEPATH -e INPUT_SKIPTESTS -e INPUT_SUPPRESSBUILDRUNNER -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/ir_sensor_plugin/ir_sensor_plugin":"/github/workspace" 3888d3:b1bc312edeed4d45b6d7826ee60b428c
2020-06-12T17:55:27.2758248Z Check inputs...
2020-06-12T17:55:27.2766622Z OK
2020-06-12T17:55:27.2827712Z Package dir: /github/workspace
2020-06-12T17:55:27.4737719Z Because ir_sensor_plugin requires the Flutter SDK, version solving failed.
2020-06-12T17:55:27.4739592Z
2020-06-12T17:55:27.4743315Z Flutter users should run `flutter pub get` instead of `pub get`.
2020-06-12T17:55:27.6977883Z Because ir_sensor_plugin requires the Flutter SDK, version solving failed.
2020-06-12T17:55:27.6982279Z
2020-06-12T17:55:27.7000896Z Flutter users should run `flutter pub get` instead of `pub get`.
2020-06-12T17:55:27.9123248Z Could not find a file named "pubspec.yaml" in "/github/home/.pub-cache/hosted/pub.dartlang.org/async-2.4.1".
2020-06-12T17:55:27.9415574Z
2020-06-12T17:55:27.9468996Z /entrypoint.sh: line 55: lines: bad array subscript
2020-06-12T17:55:28.1259968Z Post job cleanup.
2020-06-12T17:55:28.2318365Z [command]/usr/bin/git version
2020-06-12T17:55:28.2398522Z git version 2.27.0
2020-06-12T17:55:28.2432463Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2020-06-12T17:55:28.2475007Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
2020-06-12T17:55:28.2747746Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2020-06-12T17:55:28.2782449Z http.https://github.com/.extraheader
2020-06-12T17:55:28.2790918Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2020-06-12T17:55:28.2831493Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
2020-06-12T17:55:28.3185938Z Cleaning up orphan processes
Hi! Can you deploy the changes that enable Flutter in your package? And I forget add a entry in readme with format property :)
It's not intuitive, to me at least, that the build passes when the publishing fails due to errors or warnings.
Or maybe add an option for it, if you want to keep current behavior for some reason?
I was using what I was 100% sure were valid credentials with the latest stable flutter but was getting the "Pub needs your authorization to upload..." error.
Based on the answer to this question it appears that the path to the credential for Linux-based flutter is now ~/.config/dart/pub-credentials.json
(which seems legit as on my Mac the path is the one listed there as well: ~/Library/Application Support/dart/pub-credentials.json
)
I tried publishing a github action again manually putting the same credential json content the credential in this location via:
mkdir -p ~/.config/dart/
cat <<EOF > ~/.config/dart/pub-credentials.json
${{ secrets.CREDENTIAL_JSON }}
EOF
and the publish worked.
This is not a really big issue but more a feature request.
If possible, I want this action to be able to extract the release notes of the latest published version as the output.
Onepub.dev
This is more of an aesthetic suggestion but can greatly improve the usability of the action when viewing the progress on the Actions page of Github.
Instead of relying on the name
field for the package name, use a separate field, say packageName
to capture the name of the package. The name
field is used by Github to print the name of the action, which is a more user-friendly way of reading the step.
Notice in the above picture, the name of the package is the only one that shows up, which makes it difficult to know what the step is doing.
I have the following action that I want to build with force = true
, but I receive a failure https://github.com/zino-hofmann/graphql-flutter/runs/7099897390?check_suite_focus=true
name: graphql Release Package
on:
release:
types: [created]
tags:
- graphql-v*
push:
workflow_run:
workflows:
- "graphql Test case"
- "graphql Dart Code sanity check"
branches: [ main ]
types:
- completed
jobs:
publishing:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v2 # required!
- name: 'publish graphql to to Pub.dev'
uses: k-paxian/dart-package-publisher@master
with:
credentialJson: ${{ secrets.CREDENTIAL_JSON }}
flutter: false
skipTests: true
force: true
dryRunOnly: ${{ github.event_name != 'release' }}
relativePath: './packages/graphql/'
It would be great if you could also support Flutter packages. Currently it fails with the following output:
Check inputs...
OK
Switching to package directory 'flutter_mobx'
Package dir: /github/workspace/flutter_mobx
Because flutter_mobx depends on flutter_test any from sdk which doesn't exist (the Flutter SDK is not available), version solving failed.
Flutter users should run `flutter pub get` instead of `pub get`.
No pubspec.lock file found, please run "pub get" first.
/entrypoint.sh: line 35: lines: bad array subscript
##[error]Docker run failed with exit code 1
You can check if the package type is flutter by looking at the pubspec.yaml
and seeing if there is a flutter sdk specified. For those cases, you can switch to flutter specific commands for get
, test
and publish
Here's the relevant log:
Run k-paxian/dart-package-publisher@master
/usr/bin/docker run --name dfbb2c8cfddd70640b69dcf1b0e8d71f2a0_d9063a --label 488dfb --workdir /github/workspace --rm -e INPUT_RELATIVEPATH -e INPUT_ACCESSTOKEN -e INPUT_REFRESHTOKEN -e INPUT_SUPPRESSBUILDRUNNER -e INPUT_FLUTTER -e INPUT_DRYRUNONLY -e INPUT_SKIPTESTS -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/mobx.dart/mobx.dart":"/github/workspace" 488dfb:b2c8cfddd70640b69dcf1b0e8d71f2a0
Check inputs...
OK
Switching to package directory 'mobx'
Package dir: /github/workspace/mobx
Cannot open file, path = 'version' (OS Error: No such file or directory, errno = 2)
out:
Package:
Local version: []
No package found. :(
Will be implemented when sponsors number will reach 10 people.
https://calebporzio.com/sponsorware
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.