Search…
⌃K

import

The onepub import command allows you to login when a Web browser and/or user interaction isn't viable such as in a CI/CD, SSH or Docker environment.
The import command imports a OnePub authentication Token which you obtain by running the onepub export 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>
Last modified 6mo ago