mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
bolt diy to buildify.
This commit is contained in:
27
.github/workflows/ci.yaml
vendored
27
.github/workflows/ci.yaml
vendored
@@ -1,27 +0,0 @@
|
||||
name: CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup and Build
|
||||
uses: ./.github/actions/setup-and-build
|
||||
|
||||
- name: Run type check
|
||||
run: pnpm run typecheck
|
||||
|
||||
# - name: Run ESLint
|
||||
# run: pnpm run lint
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm run test
|
||||
62
.github/workflows/docker.yaml
vendored
62
.github/workflows/docker.yaml
vendored
@@ -1,62 +0,0 @@
|
||||
name: Docker Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, stable]
|
||||
tags: ['v*', '*.*.*']
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
docker-build-publish:
|
||||
runs-on: ubuntu-latest
|
||||
# timeout-minutes: 30
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata for Docker image
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||
type=raw,value=stable,enable=${{ github.ref == 'refs/heads/stable' }}
|
||||
type=ref,event=tag
|
||||
type=sha,format=short
|
||||
type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/stable' }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
target: bolt-ai-production
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Check manifest
|
||||
run: docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
|
||||
35
.github/workflows/docs.yaml
vendored
35
.github/workflows/docs.yaml
vendored
@@ -1,35 +0,0 @@
|
||||
name: Docs CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'docs/**' # This will only trigger the workflow when files in docs directory change
|
||||
permissions:
|
||||
contents: write
|
||||
jobs:
|
||||
build_docs:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./docs
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Configure Git Credentials
|
||||
run: |
|
||||
git config user.name github-actions[bot]
|
||||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
key: mkdocs-material-${{ env.cache_id }}
|
||||
path: .cache
|
||||
restore-keys: |
|
||||
mkdocs-material-
|
||||
|
||||
- run: pip install mkdocs-material
|
||||
- run: mkdocs gh-deploy --force
|
||||
238
.github/workflows/ecr-deploy.yaml
vendored
Normal file
238
.github/workflows/ecr-deploy.yaml
vendored
Normal file
@@ -0,0 +1,238 @@
|
||||
name: Build and Deploy to Amazon ECR
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, dev]
|
||||
tags: ['v*', '*.*.*']
|
||||
paths-ignore:
|
||||
- 'k8s/**'
|
||||
workflow_dispatch: # Allows manual triggering
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write # Need write permission to create branch and PR
|
||||
pull-requests: write # Need permission to create PR
|
||||
id-token: write # Required for OIDC authentication
|
||||
|
||||
env:
|
||||
AWS_REGION: us-east-1 # Change to your AWS region
|
||||
ECR_REPOSITORY_NAME: buildify # ECR repository name
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
name: Build and Deploy to ECR
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
# Enable BuildKit features with optimized memory usage
|
||||
buildkitd-flags: --allow-insecure-entitlement=network.host
|
||||
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
role-to-assume: ${{ vars.AWS_ROLE_ARN }} # The ARN of the IAM role to assume
|
||||
aws-region: ${{ env.AWS_REGION }}
|
||||
|
||||
- name: Check if ECR repository exists and create if needed
|
||||
run: |
|
||||
if ! aws ecr describe-repositories --repository-names ${{ env.ECR_REPOSITORY_NAME }} 2>/dev/null; then
|
||||
echo "Creating ECR repository: ${{ env.ECR_REPOSITORY_NAME }}"
|
||||
aws ecr create-repository --repository-name ${{ env.ECR_REPOSITORY_NAME }} \
|
||||
--image-scanning-configuration scanOnPush=true \
|
||||
--encryption-configuration encryptionType=AES256
|
||||
else
|
||||
echo "ECR repository ${{ env.ECR_REPOSITORY_NAME }} already exists, skipping creation"
|
||||
fi
|
||||
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v2
|
||||
|
||||
- name: Get ECR registry URL
|
||||
id: ecr-registry
|
||||
run: |
|
||||
echo "registry=$(aws ecr describe-repositories --repository-names ${{ env.ECR_REPOSITORY_NAME }} --query 'repositories[0].repositoryUri' --output text)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Extract metadata for Docker image
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ steps.ecr-registry.outputs.registry }}
|
||||
tags: |
|
||||
type=raw,value=${{ github.ref_name }}
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
|
||||
type=ref,event=tag
|
||||
type=sha,format=short
|
||||
|
||||
- name: Debug tags to be created
|
||||
run: |
|
||||
echo "Current GitHub ref: ${{ github.ref }}"
|
||||
echo "Tags to be created: ${{ steps.meta.outputs.tags }}"
|
||||
|
||||
# Set up cache for Docker layers
|
||||
- name: Set up Docker layer caching
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
# Pull previous image for cache if it exists
|
||||
- name: Pull previous image for cache
|
||||
run: |
|
||||
TAG="dev"
|
||||
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
|
||||
TAG="latest"
|
||||
fi
|
||||
|
||||
docker pull ${{ steps.ecr-registry.outputs.registry }}:$TAG || true
|
||||
continue-on-error: true
|
||||
|
||||
# Set NODE_OPTIONS environment variable to increase memory limit
|
||||
- name: Set Node.js memory parameters
|
||||
run: |
|
||||
echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
target: buildify-production
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
VITE_LOG_LEVEL=info
|
||||
DEFAULT_NUM_CTX=32768
|
||||
NODE_OPTIONS=--max_old_space_size=4096
|
||||
# Enable layer caching
|
||||
cache-from: |
|
||||
type=local,src=/tmp/.buildx-cache
|
||||
type=registry,ref=${{ steps.ecr-registry.outputs.registry }}:buildcache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||
# Increase resource allocation for build
|
||||
outputs: type=image
|
||||
allow: |
|
||||
network.host
|
||||
provenance: false
|
||||
|
||||
# Ensure dev tag is applied for dev branch
|
||||
- name: Ensure branch-specific tag
|
||||
if: ${{ github.ref == 'refs/heads/dev' }}
|
||||
run: |
|
||||
echo "Ensuring dev tag exists..."
|
||||
docker buildx imagetools create \
|
||||
-t ${{ steps.ecr-registry.outputs.registry }}:dev \
|
||||
${{ steps.ecr-registry.outputs.registry }}:sha-$(echo ${{ github.sha }} | cut -c1-7)
|
||||
|
||||
# Simple cache management
|
||||
- name: Manage cache
|
||||
if: always()
|
||||
run: |
|
||||
if [ -d "/tmp/.buildx-cache-new" ]; then
|
||||
echo "Moving cache to maintain build efficiency"
|
||||
else
|
||||
echo "No cache directory found"
|
||||
fi
|
||||
|
||||
# Move cache to prevent it from growing indefinitely
|
||||
- name: Move cache
|
||||
if: always()
|
||||
run: |
|
||||
if [ -d "/tmp/.buildx-cache-new" ]; then
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
echo "Cache moved successfully"
|
||||
else
|
||||
echo "No new cache to move"
|
||||
fi
|
||||
|
||||
- name: Verify image pushed
|
||||
run: |
|
||||
# Determine which tag to check based on the ref
|
||||
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
|
||||
TAG="latest"
|
||||
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
|
||||
TAG="dev"
|
||||
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||
TAG="${{ github.ref_name }}"
|
||||
else
|
||||
# Use short SHA for other branches
|
||||
TAG=$(echo ${{ github.sha }} | cut -c1-7)
|
||||
fi
|
||||
echo "Image pushed successfully: ${{ steps.ecr-registry.outputs.registry }}:$TAG"
|
||||
|
||||
# Create PR for Kubernetes manifests update (only for main branch)
|
||||
- name: Create PR for Kubernetes updates
|
||||
if: github.ref == 'refs/heads/main'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
# Set Git user
|
||||
git config --global user.name "GitHub Actions"
|
||||
git config --global user.email "actions@github.com"
|
||||
|
||||
# Create a new branch with a unique name
|
||||
BRANCH_NAME="deploy/update-k8s-$(date +%Y%m%d-%H%M%S)-${GITHUB_SHA:0:7}"
|
||||
git checkout -b $BRANCH_NAME
|
||||
|
||||
# Update deployment file with new image tag
|
||||
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||
# For tagged releases, use the tag name
|
||||
IMAGE_TAG="${{ github.ref_name }}"
|
||||
sed -i "s|891377135844.dkr.ecr.us-east-1.amazonaws.com/buildify:dev|891377135844.dkr.ecr.us-east-1.amazonaws.com/buildify:$IMAGE_TAG|g" k8s/deployment.yaml
|
||||
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
|
||||
# For main branch, use 'latest'
|
||||
IMAGE_TAG="latest"
|
||||
sed -i "s|891377135844.dkr.ecr.us-east-1.amazonaws.com/buildify:dev|891377135844.dkr.ecr.us-east-1.amazonaws.com/buildify:$IMAGE_TAG|g" k8s/deployment.yaml
|
||||
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
|
||||
# For dev branch, use 'dev'
|
||||
# No need to change as dev is already set as the default tag in deployment.yaml
|
||||
IMAGE_TAG="dev"
|
||||
echo "Using dev tag for dev branch - no change needed to deployment.yaml"
|
||||
else
|
||||
# For other branches/PRs, use the short SHA
|
||||
IMAGE_TAG="${GITHUB_SHA:0:7}"
|
||||
sed -i "s|891377135844.dkr.ecr.us-east-1.amazonaws.com/buildify:dev|891377135844.dkr.ecr.us-east-1.amazonaws.com/buildify:$IMAGE_TAG|g" k8s/deployment.yaml
|
||||
fi
|
||||
|
||||
# Show changes for logging
|
||||
echo "Modified deployment manifest:"
|
||||
cat k8s/deployment.yaml
|
||||
|
||||
# Commit changes
|
||||
git add k8s/deployment.yaml
|
||||
git commit -m "Update Kubernetes deployment to image ${{ steps.ecr-registry.outputs.registry }}:$IMAGE_TAG"
|
||||
|
||||
# Push the branch
|
||||
git push origin $BRANCH_NAME
|
||||
|
||||
# Create PR
|
||||
PR_TITLE="Update Kubernetes deployment to new image"
|
||||
PR_BODY="This PR updates the Kubernetes deployment to use the latest image built from commit ${GITHUB_SHA}.
|
||||
|
||||
Image: ${{ steps.ecr-registry.outputs.registry }}:$IMAGE_TAG
|
||||
|
||||
This PR was automatically generated by the CI/CD pipeline."
|
||||
|
||||
gh pr create --base main --head $BRANCH_NAME --title "$PR_TITLE" --body "$PR_BODY" --label "deployment" || echo "PR already exists or couldn't be created"
|
||||
|
||||
# Note about automatic scanning
|
||||
- name: Note about image scanning
|
||||
if: success()
|
||||
run: |
|
||||
echo "✅ Image successfully pushed to ECR"
|
||||
echo "Note: ECR automatically scans images (scan-on-push is enabled)"
|
||||
echo "Check the AWS ECR console for vulnerability scan results"
|
||||
98
.github/workflows/electron.yml
vendored
98
.github/workflows/electron.yml
vendored
@@ -1,98 +0,0 @@
|
||||
name: Electron Build and Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Tag for the release (e.g., v1.0.0). Leave empty if not applicable.'
|
||||
required: false
|
||||
push:
|
||||
branches:
|
||||
- electron
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest] # Use unsigned macOS builds for now
|
||||
node-version: [18.18.0]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 9.14.4
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup pnpm cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
# Install Linux dependencies
|
||||
- name: Install Linux dependencies
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y rpm
|
||||
|
||||
# Build
|
||||
- name: Build Electron app
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NODE_OPTIONS: "--max_old_space_size=4096"
|
||||
run: |
|
||||
if [ "$RUNNER_OS" == "Windows" ]; then
|
||||
pnpm run electron:build:win
|
||||
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||
pnpm run electron:build:mac
|
||||
else
|
||||
pnpm run electron:build:linux
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
# Create Release
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
# Use the workflow_dispatch input tag if available, else use the Git ref name.
|
||||
tag_name: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }}
|
||||
# Only branch pushes remain drafts. For workflow_dispatch and tag pushes the release is published.
|
||||
draft: ${{ github.event_name != 'workflow_dispatch' && github.ref_type == 'branch' }}
|
||||
# For tag pushes, name the release as "Release <tagname>", otherwise "Electron Release".
|
||||
name: ${{ (github.event_name == 'push' && github.ref_type == 'tag') && format('Release {0}', github.ref_name) || 'Electron Release' }}
|
||||
files: |
|
||||
dist/*.exe
|
||||
dist/*.dmg
|
||||
dist/*.deb
|
||||
dist/*.AppImage
|
||||
dist/*.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
31
.github/workflows/pr-release-validation.yaml
vendored
31
.github/workflows/pr-release-validation.yaml
vendored
@@ -1,31 +0,0 @@
|
||||
name: PR Validation
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, labeled, unlabeled]
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Validate PR Labels
|
||||
run: |
|
||||
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'stable-release') }}" == "true" ]]; then
|
||||
echo "✓ PR has stable-release label"
|
||||
|
||||
# Check version bump labels
|
||||
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'major') }}" == "true" ]]; then
|
||||
echo "✓ Major version bump requested"
|
||||
elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'minor') }}" == "true" ]]; then
|
||||
echo "✓ Minor version bump requested"
|
||||
else
|
||||
echo "✓ Patch version bump will be applied"
|
||||
fi
|
||||
else
|
||||
echo "This PR doesn't have the stable-release label. No release will be created."
|
||||
fi
|
||||
32
.github/workflows/semantic-pr.yaml
vendored
32
.github/workflows/semantic-pr.yaml
vendored
@@ -1,32 +0,0 @@
|
||||
name: Semantic Pull Request
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, reopened, edited, synchronize]
|
||||
permissions:
|
||||
pull-requests: read
|
||||
jobs:
|
||||
main:
|
||||
name: Validate PR Title
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# https://github.com/amannn/action-semantic-pull-request/releases/tag/v5.5.3
|
||||
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
subjectPattern: ^(?![A-Z]).+$
|
||||
subjectPatternError: |
|
||||
The subject "{subject}" found in the pull request title "{title}"
|
||||
didn't match the configured pattern. Please ensure that the subject
|
||||
doesn't start with an uppercase character.
|
||||
types: |
|
||||
fix
|
||||
feat
|
||||
chore
|
||||
build
|
||||
ci
|
||||
perf
|
||||
docs
|
||||
refactor
|
||||
revert
|
||||
test
|
||||
25
.github/workflows/stale.yml
vendored
25
.github/workflows/stale.yml
vendored
@@ -1,25 +0,0 @@
|
||||
name: Mark Stale Issues and Pull Requests
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 2 * * *' # Runs daily at 2:00 AM UTC
|
||||
workflow_dispatch: # Allows manual triggering of the workflow
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Mark stale issues and pull requests
|
||||
uses: actions/stale@v8
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue has been marked as stale due to inactivity. If no further activity occurs, it will be closed in 7 days.'
|
||||
stale-pr-message: 'This pull request has been marked as stale due to inactivity. If no further activity occurs, it will be closed in 7 days.'
|
||||
days-before-stale: 10 # Number of days before marking an issue or PR as stale
|
||||
days-before-close: 4 # Number of days after being marked stale before closing
|
||||
stale-issue-label: 'stale' # Label to apply to stale issues
|
||||
stale-pr-label: 'stale' # Label to apply to stale pull requests
|
||||
exempt-issue-labels: 'pinned,important' # Issues with these labels won't be marked stale
|
||||
exempt-pr-labels: 'pinned,important' # PRs with these labels won't be marked stale
|
||||
operations-per-run: 75 # Limits the number of actions per run to avoid API rate limits
|
||||
127
.github/workflows/update-stable.yml
vendored
127
.github/workflows/update-stable.yml
vendored
@@ -1,127 +0,0 @@
|
||||
name: Update Stable Branch
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
prepare-release:
|
||||
if: contains(github.event.head_commit.message, '#release')
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: latest
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
id: pnpm-cache
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Setup pnpm cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Get Current Version
|
||||
id: current_version
|
||||
run: |
|
||||
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
||||
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Install semver
|
||||
run: pnpm add -g semver
|
||||
|
||||
- name: Determine Version Bump
|
||||
id: version_bump
|
||||
run: |
|
||||
COMMIT_MSG="${{ github.event.head_commit.message }}"
|
||||
if [[ $COMMIT_MSG =~ "#release:major" ]]; then
|
||||
echo "bump=major" >> $GITHUB_OUTPUT
|
||||
elif [[ $COMMIT_MSG =~ "#release:minor" ]]; then
|
||||
echo "bump=minor" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "bump=patch" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Bump Version
|
||||
id: bump_version
|
||||
run: |
|
||||
NEW_VERSION=$(semver -i ${{ steps.version_bump.outputs.bump }} ${{ steps.current_version.outputs.version }})
|
||||
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update Package.json
|
||||
run: |
|
||||
NEW_VERSION=${{ steps.bump_version.outputs.new_version }}
|
||||
pnpm version $NEW_VERSION --no-git-tag-version --allow-same-version
|
||||
|
||||
- name: Prepare changelog script
|
||||
run: chmod +x .github/scripts/generate-changelog.sh
|
||||
|
||||
- name: Generate Changelog
|
||||
id: changelog
|
||||
env:
|
||||
NEW_VERSION: ${{ steps.bump_version.outputs.new_version }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
run: .github/scripts/generate-changelog.sh
|
||||
|
||||
- name: Get the latest commit hash and version tag
|
||||
run: |
|
||||
echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
||||
echo "NEW_VERSION=${{ steps.bump_version.outputs.new_version }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Commit and Tag Release
|
||||
run: |
|
||||
git pull
|
||||
git add package.json pnpm-lock.yaml changelog.md
|
||||
git commit -m "chore: release version ${{ steps.bump_version.outputs.new_version }}"
|
||||
git tag "v${{ steps.bump_version.outputs.new_version }}"
|
||||
git push
|
||||
git push --tags
|
||||
|
||||
- name: Update Stable Branch
|
||||
run: |
|
||||
if ! git checkout stable 2>/dev/null; then
|
||||
echo "Creating new stable branch..."
|
||||
git checkout -b stable
|
||||
fi
|
||||
git merge main --no-ff -m "chore: release version ${{ steps.bump_version.outputs.new_version }}"
|
||||
git push --set-upstream origin stable --force
|
||||
|
||||
- name: Create GitHub Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
VERSION="v${{ steps.bump_version.outputs.new_version }}"
|
||||
# Save changelog to a file
|
||||
echo "${{ steps.changelog.outputs.content }}" > release_notes.md
|
||||
gh release create "$VERSION" \
|
||||
--title "Release $VERSION" \
|
||||
--notes-file release_notes.md \
|
||||
--target stable
|
||||
Reference in New Issue
Block a user