Skip to content

Commit

Permalink
Explain how to publish using GitHub CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
foursixnine committed Jan 17, 2025
1 parent 8ae6c71 commit 7864e26
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:

Note that the `release` keyword used above, corresponds to a cargo profile. You can use any [profile](https://doc.rust-lang.org/cargo/reference/profiles.html) you have defined in your `Cargo.toml` file.

## Upload artifacts
## Uploading and publishing artifacts

In case publishing artifacts is needed, but not to crates.io, the following example demonstrates how to upload artifacts to the workflow run:

Expand All @@ -106,20 +106,19 @@ In case publishing artifacts is needed, but not to crates.io, the following exam
path: target/${{ matrix.BUILD_TARGET }}/cndk8
```

And to use them on a different job, i.e publishing:
And to use them on a different job, i.e publishing as a github release, check [AUTOTITLE](/actions/security-for-github-actions/security-guides/automatic-token-authentication.md) to ensure your workflows have the right permissions on the repository.

```yaml copy
- uses: {% data reusables.actions.action-checkout %}
- name: Download hello app
uses: {% data reusables.actions.action-download-artifact %}
with:
name: cndk8-hello
path: ./cndk8-hello

Check failure on line 117 in content/actions/use-cases-and-examples/building-and-testing/building-and-testing-rust.md

View workflow job for this annotation

GitHub Actions / check-links

Unable to find Page by '/actions/security-for-github-actions/security-guides/automatic-token-authentication.md'. To fix it, look at content/actions/use-cases-and-examples/building-and-testing/building-and-testing-rust.md on line 117 and see if the link is correct and active.
- name: Publish hello app to GitHub Packages
run: |
curl -u "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \
-X POST "https://uploads.github.com/repos/${{ github.repository }}/releases/assets?name=cndk8-hello.tar.gz" \
--header "Content-Type: application/gzip" \
--data-binary @./cndk8-hello/cndk8
- name: Publish hello app binary as a release on GitHub
- run: |
gh release create v0.1.0 --generate-notes
gh release upload v0.1.0 ./cndk8-hello/cndk8#my-cndk8-hello-app
```

## Publishing your package or library to crates.io
Expand Down

0 comments on commit 7864e26

Please sign in to comment.