Skip to content

Commit

Permalink
build: publish ghcr.io docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
kunish committed Jul 8, 2023
1 parent e0a3c6b commit 7b2f09e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 25 deletions.
36 changes: 29 additions & 7 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Publish Docker Image

on:
push:
release:
types: [prereleased]

jobs:
publish-docker-image:
runs-on: ubuntu-latest
if: github.event_name == 'release'
# if: github.event_name == 'release'

steps:
- uses: actions/checkout@v3
Expand All @@ -19,15 +20,36 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx

- name: Login to quay.io
# - name: Login to quay.io
# uses: docker/login-action@v2
# with:
# registry: quay.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.QUAY_PASS }}

# - name: Build quay.io image
# uses: docker/build-push-action@v4
# with:
# context: .
# builder: ${{ steps.buildx.outputs.name }}
# file: Dockerfile
# platforms: linux/amd64
# push: true
# tags: |
# 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: quay.io
username: ${{ github.repository_owner }}
password: ${{ secrets.QUAY_PASS }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build quay.io image
- name: Build ghcr.io image
uses: docker/build-push-action@v4
with:
context: .
Expand All @@ -36,6 +58,6 @@ jobs:
platforms: linux/amd64
push: true
tags: |
quay.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const HeaderWithActions = () => {
{!matchSmallScreen && (
<Tooltip label={endpointURL} withArrow>
<Code fz="xs" fw={700}>
{generalQuery?.general.dae.version || import.meta.env.__VERSION__}
{generalQuery?.general.dae.version}
</Code>
</Tooltip>
)}
Expand Down
8 changes: 0 additions & 8 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly __VERSION__: string
}

interface ImportMeta {
readonly env: ImportMetaEnv
}
11 changes: 2 additions & 9 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,16 @@ 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: {
alias: {
'~': path.resolve('src'),
},
},
plugins: [
react(),
EnvironmentPlugin({ __VERSION__: mode === 'development' ? 'dev' : hash }, { defineOn: 'import.meta.env' }),
],
plugins: [react()],
}
})

0 comments on commit 7b2f09e

Please sign in to comment.