-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
chore(ci): improve CI/CD workflows and add dependabot #533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| # Dependabot configuration for automated dependency updates | ||
| # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates | ||
|
|
||
| version: 2 | ||
| updates: | ||
| # Python backend dependencies (uv/pip) | ||
| - package-ecosystem: "pip" | ||
| directory: "/surfsense_backend" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "monday" | ||
| open-pull-requests-limit: 5 | ||
| groups: | ||
| python-minor-patch: | ||
| patterns: | ||
| - "*" | ||
| update-types: | ||
| - "minor" | ||
| - "patch" | ||
| labels: | ||
| - "dependencies" | ||
| - "python" | ||
| commit-message: | ||
| prefix: "chore(deps)" | ||
|
|
||
| # Frontend web dependencies (pnpm/npm) | ||
| - package-ecosystem: "npm" | ||
| directory: "/surfsense_web" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "monday" | ||
| open-pull-requests-limit: 5 | ||
| groups: | ||
| npm-minor-patch: | ||
| patterns: | ||
| - "*" | ||
| update-types: | ||
| - "minor" | ||
| - "patch" | ||
| labels: | ||
| - "dependencies" | ||
| - "javascript" | ||
| commit-message: | ||
| prefix: "chore(deps)" | ||
|
|
||
| # Browser extension dependencies (pnpm/npm) | ||
| - package-ecosystem: "npm" | ||
| directory: "/surfsense_browser_extension" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "monday" | ||
| open-pull-requests-limit: 5 | ||
| groups: | ||
| extension-minor-patch: | ||
| patterns: | ||
| - "*" | ||
| update-types: | ||
| - "minor" | ||
| - "patch" | ||
| labels: | ||
| - "dependencies" | ||
| - "javascript" | ||
| - "extension" | ||
| commit-message: | ||
| prefix: "chore(deps)" | ||
|
|
||
| # GitHub Actions dependencies | ||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "monday" | ||
| open-pull-requests-limit: 3 | ||
| labels: | ||
| - "dependencies" | ||
| - "github-actions" | ||
| commit-message: | ||
| prefix: "chore(ci)" | ||
|
|
||
| # Docker dependencies | ||
| - package-ecosystem: "docker" | ||
| directory: "/surfsense_backend" | ||
| schedule: | ||
| interval: "monthly" | ||
| labels: | ||
| - "dependencies" | ||
| - "docker" | ||
| commit-message: | ||
| prefix: "chore(docker)" | ||
|
|
||
| - package-ecosystem: "docker" | ||
| directory: "/surfsense_web" | ||
| schedule: | ||
| interval: "monthly" | ||
| labels: | ||
| - "dependencies" | ||
| - "docker" | ||
| commit-message: | ||
| prefix: "chore(docker)" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,45 +2,87 @@ name: Docker Publish | |||||
|
|
||||||
| on: | ||||||
| workflow_dispatch: | ||||||
| inputs: | ||||||
| push_backend: | ||||||
| description: 'Push backend image' | ||||||
| required: false | ||||||
| default: true | ||||||
| type: boolean | ||||||
| push_frontend: | ||||||
| description: 'Push frontend image' | ||||||
| required: false | ||||||
| default: true | ||||||
| type: boolean | ||||||
| release: | ||||||
| types: [published] | ||||||
| push: | ||||||
| branches: [main] | ||||||
| paths: | ||||||
| - 'surfsense_backend/Dockerfile' | ||||||
| - 'surfsense_web/Dockerfile' | ||||||
| - '.github/workflows/docker-publish.yml' | ||||||
|
|
||||||
| env: | ||||||
| REGISTRY: ghcr.io | ||||||
|
|
||||||
| jobs: | ||||||
| # build_and_push_backend: | ||||||
| # runs-on: ubuntu-latest | ||||||
| # permissions: | ||||||
| # contents: read | ||||||
| # packages: write | ||||||
| # steps: | ||||||
| # - name: Checkout repository | ||||||
| # uses: actions/checkout@v4 | ||||||
| build_and_push_backend: | ||||||
| name: Build & Push Backend | ||||||
| runs-on: ubuntu-latest | ||||||
| if: | | ||||||
| github.event_name == 'release' || | ||||||
| (github.event_name == 'workflow_dispatch' && inputs.push_backend) | ||||||
| permissions: | ||||||
| contents: read | ||||||
| packages: write | ||||||
| steps: | ||||||
| - name: Checkout repository | ||||||
| uses: actions/checkout@v4 | ||||||
|
|
||||||
| - name: Set up QEMU | ||||||
| uses: docker/setup-qemu-action@v3 | ||||||
|
|
||||||
| # - name: Set up QEMU | ||||||
| # uses: docker/setup-qemu-action@v3 | ||||||
| - name: Set up Docker Buildx | ||||||
| uses: docker/setup-buildx-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: Log in to GitHub Container Registry | ||||||
| # uses: docker/login-action@v3 | ||||||
| # with: | ||||||
| # registry: ghcr.io | ||||||
| # username: ${{ github.actor }} | ||||||
| # password: ${{ secrets.GITHUB_TOKEN }} | ||||||
| - name: Extract metadata for backend | ||||||
| id: meta-backend | ||||||
| uses: docker/metadata-action@v5 | ||||||
| with: | ||||||
| images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/surfsense_backend | ||||||
| tags: | | ||||||
| type=sha,prefix= | ||||||
| type=ref,event=branch | ||||||
| type=semver,pattern={{version}} | ||||||
| type=semver,pattern={{major}}.{{minor}} | ||||||
| type=raw,value=latest,enable={{is_default_branch}} | ||||||
|
|
||||||
| # - name: Build and push backend image | ||||||
| # uses: docker/build-push-action@v5 | ||||||
| # with: | ||||||
| # context: ./surfsense_backend | ||||||
| # file: ./surfsense_backend/Dockerfile | ||||||
| # push: true | ||||||
| # tags: ghcr.io/${{ github.repository_owner }}/surfsense_backend:${{ github.sha }} | ||||||
| # platforms: linux/amd64,linux/arm64 | ||||||
| # labels: | | ||||||
| # org.opencontainers.image.source=${{ github.repositoryUrl }} | ||||||
| # org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} | ||||||
| # org.opencontainers.image.revision=${{ github.sha }} | ||||||
| - name: Build and push backend image | ||||||
| uses: docker/build-push-action@v6 | ||||||
| with: | ||||||
| context: ./surfsense_backend | ||||||
| file: ./surfsense_backend/Dockerfile | ||||||
| push: true | ||||||
| tags: ${{ steps.meta-backend.outputs.tags }} | ||||||
| labels: ${{ steps.meta-backend.outputs.labels }} | ||||||
| platforms: linux/amd64,linux/arm64 | ||||||
| cache-from: type=gha | ||||||
| cache-to: type=gha,mode=max | ||||||
|
|
||||||
| build_and_push_frontend: | ||||||
| name: Build & Push Frontend | ||||||
| runs-on: ubuntu-latest | ||||||
| if: | | ||||||
| github.event_name == 'release' || | ||||||
| (github.event_name == 'workflow_dispatch' && inputs.push_frontend) || | ||||||
| github.event_name == 'push' | ||||||
|
Comment on lines
+82
to
+85
|
||||||
| permissions: | ||||||
| contents: read | ||||||
| packages: write | ||||||
|
|
@@ -57,19 +99,30 @@ jobs: | |||||
| - name: Log in to GitHub Container Registry | ||||||
| uses: docker/login-action@v3 | ||||||
| with: | ||||||
| registry: ghcr.io | ||||||
| registry: ${{ env.REGISTRY }} | ||||||
| username: ${{ github.actor }} | ||||||
| password: ${{ secrets.GITHUB_TOKEN }} | ||||||
|
|
||||||
| - name: Extract metadata for frontend | ||||||
| id: meta-frontend | ||||||
| uses: docker/metadata-action@v5 | ||||||
| with: | ||||||
| images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/surfsense_web | ||||||
| tags: | | ||||||
| type=sha,prefix= | ||||||
|
||||||
| type=sha,prefix= | |
| type=sha,prefix=sha- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
type=sha,prefix=configuration creates a tag with just the SHA and no prefix (e.g.,abc123). This is unconventional and may conflict with semantic version tags. Consider usingtype=sha,prefix=sha-to create tags likesha-abc123for better clarity and to avoid potential conflicts.