mirror of
https://github.com/Paillat-dev/flagger.git
synced 2026-01-02 01:06:21 +00:00
🎉 First commit
This commit is contained in:
32
.github/workflows/CI-CD.yaml
vendored
Normal file
32
.github/workflows/CI-CD.yaml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
#file: noinspection SpellCheckingInspection
|
||||
name: CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main", "dev" ]
|
||||
# Publish semver tags as releases.
|
||||
tags: [ 'v*.*.*' ]
|
||||
pull_request:
|
||||
branches: ["dev"]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
quality:
|
||||
uses: ./.github/workflows/quality.yaml
|
||||
|
||||
docker:
|
||||
needs: quality
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
id-token: write
|
||||
uses: ./.github/workflows/docker.yaml
|
||||
|
||||
deploy:
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
|
||||
needs: docker
|
||||
uses: ./.github/workflows/deploy.yaml
|
||||
secrets: inherit
|
||||
15
.github/workflows/deploy.yaml
vendored
Normal file
15
.github/workflows/deploy.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
name: Call Endpoint
|
||||
|
||||
on: workflow_call
|
||||
|
||||
jobs:
|
||||
call-endpoint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if DEPLOY_URL is set and call endpoint
|
||||
run: |
|
||||
if [ -n "${{ secrets.DEPLOY_URL }}" ]; then
|
||||
curl -X POST -H "Content-Type: application/json" -d '{"text":"Image updated"}' "${{ secrets.DEPLOY_URL }}"
|
||||
else
|
||||
echo "DEPLOY_URL is not set. Skipping."
|
||||
fi
|
||||
49
.github/workflows/docker.yaml
vendored
Normal file
49
.github/workflows/docker.yaml
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on: workflow_call
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3.11.1
|
||||
|
||||
- name: Log into registry ${{ env.REGISTRY }}
|
||||
uses: docker/login-action@v3.5.0
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5.8.0
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=ref,event=tag
|
||||
type=sha
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6.18.0
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
47
.github/workflows/quality.yaml
vendored
Normal file
47
.github/workflows/quality.yaml
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
name: Quality Checks
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
quality:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
check: [format, lint]
|
||||
include:
|
||||
- check: format
|
||||
name: "Format Check"
|
||||
command: "pdm run ruff format --check ."
|
||||
- check: lint
|
||||
name: "Lint Check"
|
||||
command: "pdm run ruff check ."
|
||||
|
||||
name: ${{ matrix.name }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Setup PDM
|
||||
uses: pdm-project/setup-pdm@v4
|
||||
with:
|
||||
cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: pdm install -d
|
||||
|
||||
- name: ${{ matrix.name }}
|
||||
run: ${{ matrix.command }}
|
||||
|
||||
check-license-header:
|
||||
name: License Header Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
- name: Setup Copywrite
|
||||
uses: hashicorp/setup-copywrite@32f9f1c86f661b8a51100768976a06f1b281a035
|
||||
- name: Check Header Compliance
|
||||
run: copywrite headers --plan --config .copywrite.hcl
|
||||
Reference in New Issue
Block a user