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