LogoLogo
  • OnePub
  • Guides
    • Installing
      • Install CLI tools
      • Register
      • Invite a member
      • Accept an Invite
      • CLI integration
        • Manually add publish_to
        • Implicit Integration
      • IDE integration
        • Android Studio
        • Visual Studio Code
      • Pre Dart 2.15
      • Pre Dart 2.12
    • Searching
    • Watching packages
    • Publishing Packages
      • The hard way
    • Private dependencies
      • The hard way
    • CLI Tools
      • login
      • logout
      • doctor
      • export
      • import
      • pub add
      • pub private
      • pub global activate
      • pub global deactivate
    • CI/CD
    • SSH
    • Docker
    • Community Choice Awards
  • Fundamentals
    • Members
    • Teams
    • Roles
    • Naming Packages
  • Workflows
    • Distributing to Customers
      • Purchase a Customer Distribution License
      • Security considerations
      • Publish a package
      • Invite a customer
      • Customer installation instructions
      • Conditions Apply
    • For Support
    • Setting up CI/CD
    • Vendoring Dependencies
    • Switching Organisations
    • Creating a Team Leader
  • FAQ
    • Is GST/VAT/Sales Tax applicable?
    • Does OnePub.dev have access to my personal information?
    • What is your SLA?
    • How do I get support?
    • How do I use OnePub from my CI/CD environment?
    • How to invite team members to join OnePub
    • How to publish a private package
    • 401: Unauthorized
  • Solved by OnePub
  • Data Retention Policy
  • Payments
Powered by GitBook
On this page
  • import
  • import --ask
  • import --file
  • import --file <path to file>

Was this helpful?

  1. Guides
  2. CLI Tools

import

PreviousexportNextpub add

Last updated 1 month ago

Was this helpful?

The onepub import command allows you to login when a Web browser and/or user interaction isn't viable such as in a , or environment.

The import command imports a OnePub authentication Token which you obtain by running the command.

The export command can either display the token to the console or save it to a file.

import

If run the import command with no arguments it expects to find an environment variable called ONEPUB_TOKEN.

This technique is mostly used in a CI/CD environment which provides a secret store (e.g. github actions).

If you need to import into a shell that you have logged in to, then use the onepub import --ask option.

The value of the ONEPUB_TOKEN environment variable is the authentication token reported by the onepub export command.

Run the onepub export command on your local machine after login into onepub

> onepub login
...
> onepub export
OnePub version: 1.4.1 

Exporting OnePub token for OnePub.

Add the following environment variable to your CI/CD secrets.

ONEPUB_TOKEN=8a3e9999-b79b-46ad-b9dc-968ff99993c1

Create the ONEPUB_TOKEN environment variable (this is usually done using your CI/CD secret store).

export ONEPUB_TOKEN=8a3e9999-b79b-46ad-b9dc-968ff99993c1
onepub import

import --ask

If you used the export command to display the token to the console then use the import --ask option and type the token into the console:

onepub import --ask
ONEPUB_TOKEN: 

import --file

If you exported the token in a file then you use the onepub import --file command to import the token.

If you didn't specify a filename when exporting the OnePub Token then the token will have been saved into `./onepub.token.yaml`.

If you run the import --file command without providing a file name then the import command will assume the file onepub.token.yaml contains the token and lives in the current directory.

import --file <path to file>

If you exported the OnePub Token to an alternatively named file or the token file is in a different directory then you can provide the path to the OnePub Token file.

onepub import --file <path to token file>
CI/CD
SSH
Docker
onepub export