diff --git a/.github/workflows/publish-docker-image.yml b/.github/workflows/publish-docker-image.yml index 80730a32..eae6131a 100644 --- a/.github/workflows/publish-docker-image.yml +++ b/.github/workflows/publish-docker-image.yml @@ -1,13 +1,13 @@ name: Publish Docker Image on: + workflow_dispatch: release: types: [prereleased] jobs: publish-docker-image: runs-on: ubuntu-latest - if: github.event_name == 'release' steps: - uses: actions/checkout@v3 @@ -19,6 +19,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + id: buildx - name: Login to quay.io uses: docker/login-action@v2 @@ -39,3 +40,23 @@ jobs: quay.io/${{ github.repository }}:latest cache-from: type=gha cache-to: type=gha,mode=max + + - name: Login to ghrc.io + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build ghcr.io image + uses: docker/build-push-action@v4 + with: + context: . + builder: ${{ steps.buildx.outputs.name }} + file: Dockerfile + platforms: linux/amd64 + push: true + tags: | + ghcr.io/${{ github.repository }}:latest + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index bdde7183..496d1a6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,8 @@ RUN apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/{apt,dpk FROM alpine +LABEL org.opencontainers.image.source=https://github.com/daeuniverse/daed + RUN mkdir -p /usr/local/share/daed/ RUN mkdir -p /etc/daed/ RUN wget -O /usr/local/share/daed/geoip.dat https://github.com/v2rayA/dist-v2ray-rules-dat/raw/master/geoip.dat diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 9fd29514..4e74d89f 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -153,7 +153,7 @@ export const HeaderWithActions = () => { {!matchSmallScreen && ( - {generalQuery?.general.dae.version || import.meta.env.__VERSION__} + {generalQuery?.general.dae.version} )} diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 4fac5e73..11f02fe2 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -1,9 +1 @@ /// - -interface ImportMetaEnv { - readonly __VERSION__: string -} - -interface ImportMeta { - readonly env: ImportMetaEnv -} diff --git a/vite.config.ts b/vite.config.ts index b0d4df31..3cac1323 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,13 +2,9 @@ import path from 'path' import react from '@vitejs/plugin-react-swc' import { defineConfig } from 'vite' -import EnvironmentPlugin from 'vite-plugin-environment' // eslint-disable-next-line import/no-default-export -export default defineConfig(async ({ mode }) => { - const { $ } = await import('execa') - const { stdout: hash } = await $`git rev-parse --short HEAD` - +export default defineConfig(() => { return { base: './', resolve: { @@ -16,9 +12,6 @@ export default defineConfig(async ({ mode }) => { '~': path.resolve('src'), }, }, - plugins: [ - react(), - EnvironmentPlugin({ __VERSION__: mode === 'development' ? 'dev' : hash }, { defineOn: 'import.meta.env' }), - ], + plugins: [react()], } })