Skip to content

Commit

Permalink
fix: NEXT_PUBLIC_SERVER_ORIGIN_URL error
Browse files Browse the repository at this point in the history
  • Loading branch information
cooderl committed Feb 28, 2024
1 parent 31cb9f0 commit a7f39ff
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 21 deletions.
55 changes: 43 additions & 12 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build WeWeRSS images and push image to docker hub
name: Build WeWeRSS Server images and push image to docker hub
on:
workflow_dispatch:
push:
Expand All @@ -7,12 +7,13 @@ on:
- "Dockerfile"
tags:
- "v*.*.*"

concurrency:
group: docker-release-${{ github.ref }}
cancel-in-progress: true

jobs:
build-images:
setup-deps:
runs-on: ubuntu-20.04
steps:
- name: Checkout
Expand All @@ -35,20 +36,17 @@ jobs:
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
build-web-images:
needs: setup-deps
runs-on: ubuntu-20.04
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_NAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}

# web
- name: Set DOCKER_REPO_TAGGED based on branch or tag
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
Expand All @@ -73,6 +71,18 @@ jobs:
-f Dockerfile \
.
push-web-images-to-docker-hub:
needs: build-web-images
runs-on: ubuntu-20.04
if: github.repository == 'cooderl/wewe-rss-web'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_NAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Set DOCKER_REPO_TAGGED based on branch or tag
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
Expand All @@ -87,7 +97,16 @@ jobs:
- name: Push image to Docker Hub
run: docker push ${{ github.repository_owner }}/wewe-rss-web:${{env.IMAGE_TAG}}

# server
build-server-images:
needs: setup-deps
runs-on: ubuntu-20.04
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set DOCKER_REPO_TAGGED based on branch or tag
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
Expand All @@ -105,13 +124,25 @@ jobs:
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/wewe-rss-server" \
--label "org.opencontainers.image.description=wewe-rss server image" \
--push \
--target web \
--target server \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache \
-t ${DOCKER_REPO_TAGGED} \
-f Dockerfile \
.
push-server-images-to-docker-hub:
needs: build-server-images
runs-on: ubuntu-20.04
if: github.repository == 'cooderl/wewe-rss-server'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_NAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Set DOCKER_REPO_TAGGED based on branch or tag
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
Expand Down
11 changes: 2 additions & 9 deletions apps/web/app/trpc-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@ import { toast } from 'sonner';
import { useRouter } from 'next/navigation';
import { setAuthCode } from './utils';

const NEXT_PUBLIC_SERVER_ORIGIN_URL = process.env.NEXT_PUBLIC_SERVER_ORIGIN_URL;

if (
NEXT_PUBLIC_SERVER_ORIGIN_URL === undefined ||
NEXT_PUBLIC_SERVER_ORIGIN_URL === ''
) {
throw new Error('app-err: NEXT_PUBLIC_SERVER_ORIGIN_URL is not defined!');
}
const serverOriginUrl = process.env.NEXT_PUBLIC_SERVER_ORIGIN_URL;

export function isTRPCClientError(
cause: unknown,
Expand Down Expand Up @@ -98,7 +91,7 @@ export const TrpcProvider: React.FC<{ children: React.ReactNode }> = ({
enabled: () => true,
}),
httpBatchLink({
url: NEXT_PUBLIC_SERVER_ORIGIN_URL + '/trpc',
url: serverOriginUrl + '/trpc',
async headers() {
const token = localStorage.getItem('authCode') || '';

Expand Down

0 comments on commit a7f39ff

Please sign in to comment.