mirror of
https://github.com/harivansh-afk/deskctl.git
synced 2026-04-15 03:00:45 +00:00
crates.io
This commit is contained in:
parent
19669fb4c1
commit
2b3d422c7b
3 changed files with 46 additions and 21 deletions
54
.github/workflows/ci.yml
vendored
54
.github/workflows/ci.yml
vendored
|
|
@ -26,7 +26,7 @@ on:
|
|||
publish_crates:
|
||||
description: Publish to crates.io
|
||||
type: boolean
|
||||
default: false
|
||||
default: true
|
||||
|
||||
env:
|
||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||
|
|
@ -309,27 +309,25 @@ jobs:
|
|||
artifacts/checksums.txt
|
||||
fi
|
||||
|
||||
publish:
|
||||
name: Publish
|
||||
publish-npm:
|
||||
name: Publish npm
|
||||
needs: [changes, update-manifests, release]
|
||||
if: github.event_name != 'pull_request' && needs.changes.outputs.rust == 'true'
|
||||
if: >-
|
||||
github.event_name != 'pull_request'
|
||||
&& needs.changes.outputs.rust == 'true'
|
||||
&& (inputs.publish_npm == true || inputs.publish_npm == '')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ needs.changes.outputs.tag }}
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
registry-url: https://registry.npmjs.org
|
||||
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y libx11-dev libxtst-dev
|
||||
|
||||
- name: Check current published state
|
||||
- name: Check if already published
|
||||
id: published
|
||||
run: |
|
||||
VERSION="${{ needs.changes.outputs.version }}"
|
||||
|
|
@ -338,13 +336,9 @@ jobs:
|
|||
else
|
||||
echo "npm=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
if curl -fsSL "https://crates.io/api/v1/crates/deskctl/${VERSION}" >/dev/null 2>&1; then
|
||||
echo "crates=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "crates=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Validate npm package
|
||||
if: steps.published.outputs.npm != 'true'
|
||||
run: node npm/deskctl/scripts/validate-package.js
|
||||
|
||||
- name: Publish npm
|
||||
|
|
@ -353,8 +347,36 @@ jobs:
|
|||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: npm publish ./npm/deskctl --access public
|
||||
|
||||
publish-crates:
|
||||
name: Publish crates.io
|
||||
needs: [changes, update-manifests, release]
|
||||
if: >-
|
||||
github.event_name != 'pull_request'
|
||||
&& needs.changes.outputs.rust == 'true'
|
||||
&& (inputs.publish_crates == true || inputs.publish_crates == '')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ needs.changes.outputs.tag }}
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y libx11-dev libxtst-dev
|
||||
|
||||
- name: Check if already published
|
||||
id: published
|
||||
run: |
|
||||
VERSION="${{ needs.changes.outputs.version }}"
|
||||
if curl -fsSL "https://crates.io/api/v1/crates/deskctl/${VERSION}" >/dev/null 2>&1; then
|
||||
echo "crates=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "crates=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Publish crates.io
|
||||
if: inputs.publish_crates && steps.published.outputs.crates != 'true'
|
||||
if: steps.published.outputs.crates != 'true'
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
run: cargo publish --locked
|
||||
|
|
|
|||
|
|
@ -59,12 +59,12 @@ The repository release workflow:
|
|||
- publishes the canonical GitHub Release asset
|
||||
- uploads `checksums.txt`
|
||||
|
||||
The registry publish workflow:
|
||||
The registry publish jobs (npm and crates.io run in parallel):
|
||||
|
||||
- targets an existing release tag
|
||||
- checks that Cargo, npm, and the requested tag all agree on version
|
||||
- checks whether that version is already published on npm and crates.io
|
||||
- only publishes the channels explicitly requested
|
||||
- target an existing release tag
|
||||
- check whether that version is already published on the respective registry
|
||||
- skip already-published versions
|
||||
- both default to enabled; can be toggled via workflow_dispatch inputs
|
||||
|
||||
## Rerun Safety
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ import DocLayout from "../layouts/DocLayout.astro";
|
|||
<li>
|
||||
<a href="https://github.com/harivansh-afk/deskctl">GitHub</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="www.crates.io">crates.io</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://www.npmjs.com/package/deskctl">npm</a>
|
||||
</li>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue