Files
waveform-analysis/.gitea/workflows/package.yml
Gitea CI Administrator 5afcab30fb
All checks were successful
Package component / package (push) Successful in 3m24s
ci: publish packages to download directory
2026-07-20 07:06:23 +00:00

86 lines
2.6 KiB
YAML

name: Package component
on:
push:
branches:
- main
workflow_dispatch:
jobs:
package:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
shell: bash
run: |
set -euo pipefail
server_url="${{ gitea.server_url }}"
repository_url="${server_url%/}/${{ gitea.repository }}.git"
git init .
git remote add origin "$repository_url"
git fetch --depth 1 origin "${{ gitea.sha }}"
git checkout --detach FETCH_HEAD
- name: Set up pnpm
run: |
corepack enable
corepack prepare pnpm@10.32.1 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Type check
run: pnpm typecheck
- name: Lint
run: pnpm lint
- name: Test with coverage
run: pnpm test:coverage
- name: Build component
run: pnpm build
- name: Pack component
run: pnpm pack --pack-destination artifacts
- name: Verify component package
shell: bash
run: |
set -euo pipefail
package_file="$(find artifacts -maxdepth 1 -type f -name '*.tgz' -print -quit)"
test -n "$package_file"
package_contents="$(tar -tzf "$package_file")"
for required_file in \
package/dist/index.js \
package/dist/index.cjs \
package/dist/types/index.d.ts \
package/dist/style.css \
package/package.json \
package/README.md; do
grep -Fxq "$required_file" <<< "$package_contents"
done
- name: Publish component package
shell: bash
run: |
set -euo pipefail
package_file="$(find artifacts -maxdepth 1 -type f -name '*.tgz' -print -quit)"
package_version="$(node -p "require('./package.json').version")"
short_sha="$(printf '%.12s' '${{ gitea.sha }}')"
published_name="waveform-analysis-${package_version}-${short_sha}.tgz"
install -m 644 "$package_file" "/downloads/$published_name"
cd /downloads
sha256sum "$published_name" > "$published_name.sha256"
ln -sfn "$published_name" waveform-analysis-latest.tgz
ln -sfn "$published_name.sha256" waveform-analysis-latest.tgz.sha256
- name: Upload component package
uses: https://lqycustomsite.online/admin/actions-upload-artifact@v3
with:
name: waveform-analysis-${{ gitea.sha }}
path: artifacts/*.tgz
if-no-files-found: error
retention-days: 7