Files
conventional-semantic-git-t…/.gitea/workflows/ci.yaml
Timo Behrendt 01ba559bd1
Some checks failed
CI / Dry-Run (pull_request) Successful in 13s
CI / Prerelease Test (pull_request) Failing after 12s
CI / Check Dist (pull_request) Failing after 42s
CI / Test (pull_request) Successful in 56s
feat: add ability to create pre-releases
2025-09-30 17:18:30 +02:00

104 lines
2.8 KiB
YAML

name: CI
on:
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version-file: .nvmrc
- run: npm ci
- name: Format code
run: npm run format
- name: Typecheck
run: npm run typecheck
- name: Run test
run: npm run test
check-dist:
name: Check Dist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version-file: .nvmrc
- run: npm ci
- run: mv dist dist_orig
- run: npm run build
- run: |
original_hash=$(sha256sum dist_orig/index.js | cut -d' ' -f1)
new_hash=$(sha256sum dist/index.js | cut -d' ' -f1)
if [ "$original_hash" != "$new_hash" ]; then
echo "Build is not up to date. Original hash: $original_hash, new hash: $new_hash"
exit 1
fi
dry-run:
name: Dry-Run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-node@v5
with:
node-version-file: .nvmrc
- run: npm ci
- name: Increment tag
id: increment-tag
uses: ./
with:
token: ${{ secrets.GITEA_TOKEN }}
- name: Print new tag
run: |
if [ -z "${{ steps.increment-tag.outputs.new-tag }}" ]; then
echo "No new tag found"
exit 1
fi
echo "New tag: ${{ steps.increment-tag.outputs.new-tag }}"
prerelease-test:
name: Prerelease Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-node@v5
with:
node-version-file: .nvmrc
- run: npm ci
- name: Test prerelease tag generation
id: prerelease-tag
uses: ./
with:
token: ${{ secrets.GITEA_TOKEN }}
prerelease: "true"
- name: Verify prerelease tag format
run: |
new_tag="${{ steps.prerelease-tag.outputs.new-tag }}"
echo "Generated prerelease tag: $new_tag"
# Check if tag contains -rc- prefix
if [[ "$new_tag" == *"-rc-"* ]]; then
echo "✓ Prerelease tag format is correct"
else
echo "✗ Prerelease tag format is incorrect. Expected format: X.Y.Z-rc-<sha>"
exit 1
fi
# Check if tag ends with a hash-like string (at least 7 characters)
if [[ "$new_tag" =~ -rc-[a-f0-9]{7,}$ ]]; then
echo "✓ Prerelease tag contains valid SHA suffix"
else
echo "✗ Prerelease tag SHA suffix is invalid"
exit 1
fi