mirror of
https://github.com/harivansh-afk/deskctl.git
synced 2026-04-15 09:01:15 +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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue