97b2089857
- Added `--route` and `--method` options to `function execute` command for better HTTP handling. - Improved `get function` command to display additional function metadata including HTTP settings, cache status, network restrictions, RAM limits, timeouts, and tags. - Removed deprecated `helloworld` command. - Expanded `update function` command with new options for Docker mounts, network restrictions, and various installation flags, including better error handling for boolean and number options. - Introduced environment variable management commands: `add`, `list`, and `remove` for account-wide environment variables. - Added `export` command to export authenticated account data. - Implemented `api openapi` and `api request` commands for direct API interaction. - Created logging and rate limit management commands for functions. - Added MCP tool commands for calling tools, fetching documentation, and initializing sessions. - Introduced utility functions for JSON handling and environment variable normalization. - Set up CI/CD pipeline with Gitea Actions for automated testing, building, and publishing. - Updated configuration loading to support environment variables for instance and token.
122 lines
3.3 KiB
YAML
122 lines
3.3 KiB
YAML
name: CI / CD
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
name: Test and Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "24"
|
|
registry-url: "https://registry.npmjs.org"
|
|
|
|
- name: Resolve pnpm store
|
|
id: pnpm-store
|
|
run: echo "STORE_PATH=$(pnpm store path)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Cache pnpm store
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('package.json', 'pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --no-frozen-lockfile
|
|
|
|
- name: Test
|
|
run: pnpm test
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
- name: Package dist
|
|
run: zip -r dist.zip dist package.json README.md
|
|
|
|
- name: Upload dist artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: shsf-cli-dist
|
|
path: dist.zip
|
|
|
|
publish:
|
|
name: Publish
|
|
needs: build
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "24"
|
|
registry-url: "https://registry.npmjs.org"
|
|
|
|
- name: Resolve pnpm store
|
|
id: pnpm-store
|
|
run: echo "STORE_PATH=$(pnpm store path)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Cache pnpm store
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('package.json', 'pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --no-frozen-lockfile
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
- name: Publish to npm
|
|
run: |
|
|
if [ -z "${NODE_AUTH_TOKEN}" ]; then
|
|
echo "NPM_TOKEN is not configured; skipping npm publish."
|
|
exit 0
|
|
fi
|
|
pnpm publish --no-git-checks
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Package release archive
|
|
run: zip -r dist.zip dist package.json README.md
|
|
|
|
- name: Create Gitea release
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
run: |
|
|
if [ -z "${GITEA_TOKEN}" ]; then
|
|
echo "GITEA_TOKEN is not configured; skipping Gitea release."
|
|
exit 0
|
|
fi
|
|
VERSION="$(node -p "require('./package.json').version")"
|
|
API="${GITEA_SERVER_URL%/}/api/v1/repos/${GITEA_REPOSITORY}/releases"
|
|
curl -sSf \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"v${VERSION}\",\"target_commitish\":\"${GITHUB_SHA}\",\"name\":\"v${VERSION}\",\"body\":\"Automated SHSF CLI release v${VERSION}\",\"draft\":false,\"prerelease\":false}" \
|
|
"$API"
|