-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add crate registry publish workflow
Fixes #35
- Loading branch information
1 parent
074e246
commit 6084bf3
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Publish Rust crates | ||
|
||
# When using this workflow, specify that it runs on tag creation: | ||
# | ||
# on: | ||
# push: | ||
# tags: | ||
# # For root tags, such as v0.4.2 | ||
# - "v[0-9]+.[0-9]+.[0-9]+" | ||
# - "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+" | ||
# # For subfolder tags, such as workflow-engine-v1.18.0 | ||
# #- "[a-zA-Z-_]+v[0-9]+.[0-9]+.[0-9]+" | ||
# #- "[a-zA-Z-_]+v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
registry_name: | ||
description: "Name of the registry" | ||
required: true | ||
type: string | ||
default: "famedly" | ||
registry_index: | ||
description: "URL of the registry index" | ||
required: true | ||
type: string | ||
default: "ssh://[email protected]/famedly/crate-index.git" | ||
packages: | ||
description: "List of packages to publish; space-separated list" | ||
type: string | ||
features: | ||
description: "List of features to publish; space-separated list" | ||
type: string | ||
secrets: | ||
registry-auth-token: | ||
required: true | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
container: docker-oss.nexus.famedly.de/rust-container:nightly | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: famedly/backend-build-workflows/.github/actions/rust-prepare@main | ||
with: | ||
gitlab_ssh: ${{ secrets.CI_SSH_PRIVATE_KEY}} | ||
gitlab_user: ${{ secrets.GITLAB_USER }} | ||
gitlab_pass: ${{ secrets.GITLAB_PASS }} | ||
famedly_crates_registry_index: ${{ inputs.registry_index }} | ||
- name: Install registry token | ||
# Uses `echo` (bash built-in) to prevent leaking the token | ||
# through CLI args in /proc | ||
run: | | ||
echo '[registries.${{ inputs.registry_name }}]' > "${CARGO_HOME}" | ||
echo '${{ secrets.registry-auth-token }}' >> "${CARGO_HOME}" | ||
- name: Publish | ||
run: | | ||
cargo publish --registry famedly \ | ||
${{ inputs.packages != null && format('--package {0}', inputs.packages) || "" }} \ | ||
${{ inputs.features != null && format('--features {0}', inputs.features) || "" }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters