Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Combine backend and web Github workflows

Blue Mouse933b530bd6f0
diff --git a/.github/funding.yml b/.github/funding.yml
index f7cbd9642..cc927cbd6 100644
--- a/.github/funding.yml
+++ b/.github/funding.yml
@@ -1,2 +1 @@
github: swetrix
-ko_fi: andriir
diff --git a/web/.github/workflows/fly.yml b/.github/workflows/fly.yml
similarity index 91%
rename from web/.github/workflows/fly.yml
rename to .github/workflows/fly.yml
index cc0694cb6..68844bcb6 100644
--- a/web/.github/workflows/fly.yml
+++ b/.github/workflows/fly.yml
@@ -12,5 +12,6 @@ jobs:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
+ working-directory: web
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index e54553024..d47fd0a96 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -1,5 +1,4 @@
-name: Pull request validation workflow
-
+name: Pull Request Validation Workflow
on:
push:
branches: [main]
@@ -8,26 +7,55 @@ on:
types: [opened, labeled, synchronize, ready_for_review]
jobs:
- checks:
+ backend-checks:
+ name: Backend Checks
runs-on: ubuntu-latest
-
strategy:
matrix:
- node-version: [16.19.x]
-
+ node-version: [22.x.x]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
persist-credentials: false
-
- name: Setup NodeJS ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
-
- - name: Install
+ - name: Install Backend Dependencies
run: npm install --force
+ working-directory: backend
+ - name: Backend Lint Validation
+ run: npm run lint
+ working-directory: backend
- - name: Lint validation
+ web-checks:
+ name: Web Checks
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ node-version: [22.x.x]
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v2
+ with:
+ persist-credentials: false
+ - name: Setup NodeJS ${{ matrix.node-version }}
+ uses: actions/setup-node@v1
+ with:
+ node-version: ${{ matrix.node-version }}
+ - name: Install Web Dependencies
+ run: yarn install
+ working-directory: web
+ - name: Web Lint Validation
run: npm run lint
+ working-directory: web
+ - name: Web Code Formatting Validation
+ run: npm run format
+ working-directory: web
+ - name: Web TypeScript Validation
+ run: npm run typecheck
+ working-directory: web
+ - name: Web Knip Validation
+ run: npm run knip
+ working-directory: web
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7f9a1e635..14ecde8b7 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,48 +1,77 @@
-name: Publish Docker image
-
+name: Publish Docker images
on:
release:
types: [published]
jobs:
- push_to_registry:
- name: Push Docker image to Docker Hub
+ push_backend_to_registry:
+ name: Push Swetrix API Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
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: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
- - name: Extract metadata (tags, labels) for Docker
- id: meta
+ - name: Extract metadata (tags, labels) for Backend Docker
+ id: meta_backend
uses: docker/metadata-action@v5
with:
images: swetrix/swetrix-api
-
- - name: Build and push Docker image
+ - name: Build and push Backend Docker image
uses: docker/build-push-action@v5
with:
- context: .
- file: ./Dockerfile
+ context: ./backend
+ file: ./backend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
- tags: ${{ steps.meta.outputs.tags }}
- labels: ${{ steps.meta.outputs.labels }}
-
- - name: Update repo description
+ tags: ${{ steps.meta_backend.outputs.tags }}
+ labels: ${{ steps.meta_backend.outputs.labels }}
+ - name: Update Backend repo description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: swetrix/swetrix-api
+
+ push_web_to_registry:
+ name: Push Swetrix FE Docker image to Docker Hub
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out the repo
+ 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: Login to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+ - name: Extract metadata (tags, labels) for Web Docker
+ id: meta_web
+ uses: docker/metadata-action@v5
+ with:
+ images: swetrix/swetrix-fe
+ - name: Build and push Web Docker image
+ uses: docker/build-push-action@v5
+ with:
+ context: ./web
+ file: ./web/Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: true
+ tags: ${{ steps.meta_web.outputs.tags }}
+ labels: ${{ steps.meta_web.outputs.labels }}
+ - name: Update Web repo description
+ uses: peter-evans/dockerhub-description@v4
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+ repository: swetrix/swetrix-fe
diff --git a/web/.github/funding.yml b/web/.github/funding.yml
deleted file mode 100644
index f7cbd9642..000000000
--- a/web/.github/funding.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-github: swetrix
-ko_fi: andriir
diff --git a/web/.github/workflows/pull_request.yml b/web/.github/workflows/pull_request.yml
deleted file mode 100644
index 62e689d5b..000000000
--- a/web/.github/workflows/pull_request.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-name: Pull request validation workflow
-
-on:
- push:
- branches: [main]
- pull_request:
- branches: [main]
- types: [opened, labeled, synchronize, ready_for_review]
-
-jobs:
- checks:
- runs-on: ubuntu-latest
-
- strategy:
- matrix:
- node-version: [20.12.x]
-
- steps:
- - name: Checkout Repository
- uses: actions/checkout@v2
- with:
- persist-credentials: false
-
- - name: Setup NodeJS ${{ matrix.node-version }}
- uses: actions/setup-node@v1
- with:
- node-version: ${{ matrix.node-version }}
-
- - name: Install dependencies
- run: yarn install
-
- - name: Lint validation
- run: npm run lint
-
- - name: Code formatting validation
- run: npm run format
-
- - name: TypeScript validation
- run: npm run typecheck
-
- - name: Knip validation
- run: npm run knip
diff --git a/web/.github/workflows/release.yml b/web/.github/workflows/release.yml
deleted file mode 100644
index ade7c0181..000000000
--- a/web/.github/workflows/release.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-name: Publish Docker image
-
-on:
- release:
- types: [published]
-
-jobs:
- push_to_registry:
- name: Push Docker image to Docker Hub
- runs-on: ubuntu-latest
- steps:
- - name: Check out the repo
- 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: Login to Docker Hub
- uses: docker/login-action@v3
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
-
- - name: Extract metadata (tags, labels) for Docker
- id: meta
- uses: docker/metadata-action@v5
- with:
- images: swetrix/swetrix-fe
-
- - name: Build and push Docker image
- uses: docker/build-push-action@v5
- with:
- context: .
- file: ./Dockerfile
- platforms: linux/amd64,linux/arm64
- push: true
- tags: ${{ steps.meta.outputs.tags }}
- labels: ${{ steps.meta.outputs.labels }}
-
- - name: Update repo description
- uses: peter-evans/dockerhub-description@v4
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
- repository: swetrix/swetrix-fe