Compare commits
2
Commits
ae6b3e8b9e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
615f6615e0 | ||
|
|
10cc93104a |
+14
-16
@@ -1,6 +1,7 @@
|
||||
name: Build and deploy Docker image
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
@@ -12,24 +13,21 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Isolate Docker auth
|
||||
run: |
|
||||
mkdir -p "$RUNNER_TEMP/docker-config"
|
||||
echo "DOCKER_CONFIG=$RUNNER_TEMP/docker-config" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.dsrptlab.com
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
- name: Build and publish
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker build -t "$IMAGE:latest" -t "$IMAGE:${{ gitea.sha }}" .
|
||||
docker push "$IMAGE:latest"
|
||||
docker push "$IMAGE:${{ gitea.sha }}"
|
||||
docker image rm -f "$IMAGE:latest" "$IMAGE:${{ gitea.sha }}"
|
||||
|
||||
- name: Deploy to Dokploy
|
||||
run: curl -fsS -X POST "https://ind.dsrptlab.com/api/deploy/8KU24cMi_nHB4S16dhDB3"
|
||||
- name: Remove local image tags
|
||||
run: docker image rm -f "$IMAGE:latest" "$IMAGE:${{ gitea.sha }}"
|
||||
|
||||
- name: Deploy in Dokploy
|
||||
env:
|
||||
DOKPLOY_DEPLOY_WEBHOOK: ${{ secrets.DOKPLOY_DEPLOY_WEBHOOK }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$DOKPLOY_DEPLOY_WEBHOOK"
|
||||
curl -fsS -X POST "$DOKPLOY_DEPLOY_WEBHOOK"
|
||||
|
||||
|
||||
+13
-5
@@ -79,6 +79,12 @@ function scopesFromPayload(payload: JWTPayload): string[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
function clientScopes(payload: JWTPayload): string[] {
|
||||
return [
|
||||
...new Set([...scopesFromPayload(payload), "teams:user", "teams:member"]),
|
||||
];
|
||||
}
|
||||
|
||||
function claimList(payload: JWTPayload, key: string): string[] {
|
||||
const value = (payload as Record<string, unknown>)[key];
|
||||
if (typeof value === "string") return value.split(" ");
|
||||
@@ -115,12 +121,14 @@ export async function teamContext(req: FastifyRequest): Promise<AuthContext> {
|
||||
audience: LOGTO_ORDERS_AUDIENCE,
|
||||
});
|
||||
|
||||
const teamUuid = (payload as Record<string, unknown>).team_uuid as
|
||||
| string
|
||||
| undefined;
|
||||
const scopes = scopesFromPayload(payload);
|
||||
const claimedTeamUuid = (payload as Record<string, unknown>).team_uuid;
|
||||
const teamUuid =
|
||||
typeof claimedTeamUuid === "string" && claimedTeamUuid.length > 0
|
||||
? claimedTeamUuid
|
||||
: payload.sub;
|
||||
const scopes = clientScopes(payload);
|
||||
|
||||
if (!teamUuid || !scopes.includes("teams:member")) {
|
||||
if (!payload.sub || !teamUuid) {
|
||||
throw unauthenticated();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user