88 lines
2.8 KiB
YAML
88 lines
2.8 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: self-hosted
|
|
container: git.mcpeakdev.com/mcpeakdev/bun-ci:latest
|
|
outputs:
|
|
artifact_name: ${{ steps.meta.outputs.name }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set artifact name
|
|
id: meta
|
|
run: |
|
|
if [[ "${{ github.ref_type }}" == "tag" ]]; then
|
|
tag="${GITHUB_REF_NAME#v}"
|
|
else
|
|
tag="$(date -u +%Y%m%d)"
|
|
fi
|
|
echo "name=portfolio_${tag}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
printf '@nychthemeron:registry=https://git.mcpeakdev.com/api/packages/McPeakDev/npm/\n//git.mcpeakdev.com/api/packages/McPeakDev/npm/:_authToken=%s\n' "$REGISTRY_TOKEN" > .npmrc
|
|
bun install --frozen-lockfile
|
|
rm .npmrc
|
|
env:
|
|
BUN_AUTH_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Audit dependencies
|
|
run: bun audit || true
|
|
|
|
- name: Run unit tests
|
|
run: bun run test:unit run
|
|
|
|
- name: Type check
|
|
run: bun run type-check -- --force
|
|
|
|
- name: Build
|
|
run: bun run build-only
|
|
|
|
- name: Upload dist
|
|
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
|
with:
|
|
name: ${{ steps.meta.outputs.name }}.zip
|
|
path: dist
|
|
|
|
publish:
|
|
needs: build
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: self-hosted
|
|
container: git.mcpeakdev.com/mcpeakdev/docker-pub:latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download dist
|
|
uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
|
with:
|
|
name: ${{ needs.build.outputs.artifact_name }}.zip
|
|
path: dist
|
|
|
|
- name: Log in to registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.mcpeakdev.com
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Extract image tag
|
|
id: meta
|
|
run: echo "tag=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
git.mcpeakdev.com/mcpeakml/portfolio:${{ steps.meta.outputs.tag }}
|
|
git.mcpeakdev.com/mcpeakml/portfolio:latest
|