Skip to content

Codex Remote SSH v0.5.0 #8

Codex Remote SSH v0.5.0

Codex Remote SSH v0.5.0 #8

Workflow file for this run

name: Publish GitHub Package
on:
workflow_dispatch:
release:
types:
- published
permissions:
contents: read
packages: write
jobs:
publish:
name: Publish npm package to GitHub Packages
runs-on: ubuntu-latest
defaults:
run:
working-directory: plugins/remote-ssh
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://npm.pkg.github.com
scope: "@zaintechnologiesltd"
- name: Install dependencies
run: npm install --ignore-scripts
- name: Run tests
run: npm test
- name: Check published version
id: package
shell: bash
run: |
PACKAGE_NAME="$(node -p "require('./package.json').name")"
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
if npm view "${PACKAGE_NAME}@${PACKAGE_VERSION}" version --registry https://npm.pkg.github.com >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "${PACKAGE_NAME}@${PACKAGE_VERSION} is already published."
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package
if: steps.package.outputs.exists != 'true'
run: npm publish --registry https://npm.pkg.github.com
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}