Skip to content

Commit 6150931

Browse files
committed
Explain how to publish using GitHub CLI
1 parent 8ae6c71 commit 6150931

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

content/actions/use-cases-and-examples/building-and-testing/building-and-testing-rust.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494

9595
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.
9696

97-
## Upload artifacts
97+
## Uploading and publishing artifacts
9898

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

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

109-
And to use them on a different job, i.e publishing:
109+
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) to ensure your workflows have the right permissions on the repository.
110110

111111
```yaml copy
112+
- uses: {% data reusables.actions.action-checkout %}
112113
- name: Download hello app
113114
uses: {% data reusables.actions.action-download-artifact %}
114115
with:
115116
name: cndk8-hello
116117
path: ./cndk8-hello
117-
- name: Publish hello app to GitHub Packages
118-
run: |
119-
curl -u "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \
120-
-X POST "https://uploads.github.com/repos/${{ github.repository }}/releases/assets?name=cndk8-hello.tar.gz" \
121-
--header "Content-Type: application/gzip" \
122-
--data-binary @./cndk8-hello/cndk8
118+
- name: Publish hello app binary as a release on GitHub
119+
- run: |
120+
gh release create v0.1.0 --generate-notes
121+
gh release upload v0.1.0 ./cndk8-hello/cndk8#my-cndk8-hello-app
123122
```
124123

125124
## Publishing your package or library to crates.io

0 commit comments

Comments
 (0)