A release job reads issues, builds a package and publishes it. Give the changelog step its issue token and the publishing step its registry token. The build can run with neither saved credential.
Put each credential next to the program that uses it
Suppose your repository has a changelog script that reads GITHUB_TOKEN and a publishing script that reads NPM_TOKEN. Both names are already saved with the agent. The commands can live in the repository’s release instructions.
asecret run --secret GITHUB_TOKEN -- node scripts/changelog.mjs
npm run build
asecret run --secret NPM_TOKEN -- node scripts/publish.mjsThe middle command needs only the build inputs and files the previous step produced. If the changelog script receives a provider token limited to reading issues, it can do its job with that access. The publishing credential stays available for the final step. When one reviewed program genuinely needs two saved credentials, repeat the flag before the separator, as in asecret run --secret FIRST_KEY --secret SECOND_KEY -- ./task. Running with saved secrets
Account for the enclosing environment
The names on the command line select the entries that aSecret fetches. The launched process also inherits the ordinary environment of the shell or runner that started it. A parent shell that already exports NPM_TOKEN would supply it even to the build command in this example. Start these steps in a job where the provider credentials are held in aSecret and the runner supplies only the variables each step needs.
A script can read its environment and pass it along to child processes. Review the code, plugins and hooks that run inside the step holding the publishing credential. Move preparatory work, such as formatting a changelog, into an earlier step when it can run independently.
Tell a launch failure from a task failure
If a requested name is missing, aSecret stops before starting the program. Check the entries with asecret list under the same agent. If the program ran and the provider refused the request, check the credential’s permissions at the provider. Keep the provider’s status code or operation name in your logs. Printing every environment variable to diagnose an error would disclose the values the command received.
The CLI forwards the launched command’s exit code, so a release runner can stop on a failed step and report which program failed. CLI exit codes