Add HTML and CSS language support #44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Publish Docker Image to GHCR | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| image-digest: ${{ steps.build.outputs.digest }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - 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 | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=branch | |
| type=sha,prefix={{branch}}- | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Build and push Docker image | |
| id: build | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| continue-on-error: false | |
| upload-model-to-s3: | |
| needs: build-and-push | |
| runs-on: ubuntu-latest | |
| if: false # Disabled - enable when AWS credentials are configured | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ vars.AWS_REGION || 'us-east-1' }} | |
| - name: Upload model to S3 | |
| run: | | |
| if [ -f "models/code_quality_model.joblib" ]; then | |
| aws s3 cp models/code_quality_model.joblib \ | |
| s3://${{ vars.AWS_S3_BUCKET }}/models/code_quality_model.joblib \ | |
| --acl private | |
| echo "✓ Model uploaded to S3" | |
| else | |
| echo "⚠ No model file found, skipping S3 upload" | |
| fi | |
| - name: Generate presigned URL | |
| id: presigned-url | |
| run: | | |
| PRESIGNED_URL=$(aws s3 presign \ | |
| s3://${{ vars.AWS_S3_BUCKET }}/models/code_quality_model.joblib \ | |
| --expires-in 31536000) | |
| echo "model-url=$PRESIGNED_URL" >> $GITHUB_OUTPUT | |
| echo "✓ Generated presigned URL (valid for 1 year)" |