123 lines
2.7 KiB
Markdown
123 lines
2.7 KiB
Markdown
# SZCI Gitea CI/CD Workflows
|
||
|
||
This directory contains Gitea Actions workflows for automated CI/CD of the SZCI project.
|
||
|
||
## Workflows
|
||
|
||
### 1. CI (`ci.yml`)
|
||
|
||
**Trigger:** Push to `master` branch or pull requests
|
||
|
||
**Purpose:** Continuous integration checks on every push
|
||
|
||
**Jobs:**
|
||
- **Type Check & Lint** - Validates TypeScript types and code style
|
||
- **Build Test** - Compiles binary for Linux x64 and tests execution
|
||
- **Build All Platforms** - Compiles all 5 platform binaries and uploads as artifacts
|
||
|
||
**Usage:** Automatically runs on every commit to ensure code quality
|
||
|
||
---
|
||
|
||
### 2. Release (`release.yml`)
|
||
|
||
**Trigger:** Push of version tags (e.g., `v5.0.0`)
|
||
|
||
**Purpose:** Creates GitHub releases with pre-compiled binaries
|
||
|
||
**Jobs:**
|
||
1. Validates deno.json version matches git tag
|
||
2. Compiles binaries for all 5 platforms
|
||
3. Generates SHA256 checksums
|
||
4. Creates Gitea release with binaries as assets
|
||
5. Cleans up old releases (keeps last 3)
|
||
|
||
**Usage:**
|
||
```bash
|
||
# Update version in deno.json to 6.0.1
|
||
# Then create and push tag:
|
||
git tag v6.0.1
|
||
git push origin v6.0.1
|
||
```
|
||
|
||
**Output:** Release at `https://code.foss.global/ship.zone/szci/releases/tag/v6.0.1`
|
||
|
||
---
|
||
|
||
### 3. NPM Publish (`npm-publish.yml`)
|
||
|
||
**Trigger:** Push of version tags (e.g., `v5.0.0`)
|
||
|
||
**Purpose:** Publishes package to npm registry
|
||
|
||
**Jobs:**
|
||
1. Validates deno.json version matches git tag
|
||
2. Compiles all binaries
|
||
3. Syncs package.json version
|
||
4. Creates npm package
|
||
5. Publishes to npm with access token
|
||
6. Verifies publication
|
||
|
||
**Prerequisites:**
|
||
- `NPM_TOKEN` must be set in Gitea secrets
|
||
|
||
**Usage:** Same as release workflow (automatically triggered by version tags)
|
||
|
||
**Output:** Package at `https://www.npmjs.com/package/@ship.zone/szci`
|
||
|
||
---
|
||
|
||
## Release Process
|
||
|
||
To create a new release:
|
||
|
||
1. **Update version in deno.json:**
|
||
```json
|
||
{
|
||
"version": "6.0.1"
|
||
}
|
||
```
|
||
|
||
2. **Commit the version change:**
|
||
```bash
|
||
git add deno.json
|
||
git commit -m "6.0.1"
|
||
```
|
||
|
||
3. **Create and push tag:**
|
||
```bash
|
||
git tag v6.0.1
|
||
git push origin master
|
||
git push origin v6.0.1
|
||
```
|
||
|
||
4. **Workflows run automatically:**
|
||
- `release.yml` creates Gitea release with binaries
|
||
- `npm-publish.yml` publishes to npm
|
||
|
||
5. **Verify:**
|
||
- Check https://code.foss.global/ship.zone/szci/releases
|
||
- Check https://www.npmjs.com/package/@ship.zone/szci
|
||
|
||
---
|
||
|
||
## Secrets Required
|
||
|
||
Configure these in Gitea repository settings:
|
||
|
||
- `GITHUB_TOKEN` - Gitea access token (auto-provided)
|
||
- `NPM_TOKEN` - npm publish token (must be configured)
|
||
|
||
---
|
||
|
||
## Binary Artifacts
|
||
|
||
Each workflow produces binaries for:
|
||
- Linux x86_64
|
||
- Linux ARM64
|
||
- macOS x86_64
|
||
- macOS ARM64
|
||
- Windows x86_64
|
||
|
||
Total size per release: ~4GB (5 binaries × ~800MB each)
|