diff --git a/.github/workflows/docker-publish-dockerhub.yml b/.github/workflows/docker-publish-dockerhub.yml index 01f95ac..28ef4ce 100644 --- a/.github/workflows/docker-publish-dockerhub.yml +++ b/.github/workflows/docker-publish-dockerhub.yml @@ -96,6 +96,7 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64,linux/arm/v7 build-args: | VERSION=${{ env.VERSION }} BUILD_TIME=${{ env.BUILD_TIME }} diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 479fd70..42d1589 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -97,6 +97,7 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64,linux/arm/v7 build-args: | VERSION=${{ env.VERSION }} BUILD_TIME=${{ env.BUILD_TIME }} diff --git a/.github/workflows/docusaurus-deploy.yml b/.github/workflows/docusaurus-deploy.yml new file mode 100644 index 0000000..1eba9f4 --- /dev/null +++ b/.github/workflows/docusaurus-deploy.yml @@ -0,0 +1,55 @@ +name: Deploy Docusaurus to GitHub Pages + +on: + push: + branches: [main] + paths: ['docs/**'] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build: + name: Deploy Docusaurus + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./docs + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: yarn + cache-dependency-path: docs/yarn.lock + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build + run: yarn build + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: ./docs/build + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 \ No newline at end of file diff --git a/.gitignore b/.gitignore index c102b0c..5a30c78 100644 --- a/.gitignore +++ b/.gitignore @@ -70,4 +70,15 @@ backups/ static/dist/ # Ignore binaries -gomft \ No newline at end of file +gomft + +# Docusaurus files +docs/.docusaurus/ +docs/.cache-loader/ +docs/build/ +docs/build-searchindex/ +docs/static/search/ +docs/static/js/ +docs/node_modules/ +docs/.env* +docs/*.log \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0785d97..d0a0242 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,6 +35,10 @@ WORKDIR /app ARG VERSION=dev ARG BUILD_TIME=unknown ARG COMMIT=unknown +# Architecture-related build arguments +ARG TARGETOS=linux +ARG TARGETARCH=amd64 +ARG TARGETVARIANT="" # Install build dependencies RUN apk add --no-cache git build-base @@ -66,15 +70,22 @@ COPY . . RUN templ generate # Compile the application with version information -RUN CGO_ENABLED=0 GOOS=linux go build \ +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \ -ldflags "-X github.com/starfleetcptn/gomft/components.AppVersion=${VERSION} -X main.Version=${VERSION} -X main.BuildTime=${BUILD_TIME} -X main.Commit=${COMMIT} -X github.com/starfleetcptn/gomft/components.BuildTime=${BUILD_TIME} -X github.com/starfleetcptn/gomft/components.Commit=${COMMIT}" \ -o /app/gomft -# Install rclone +# Install rclone with appropriate architecture RUN apk add --no-cache curl unzip && \ - curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip && \ - unzip rclone-current-linux-amd64.zip && \ - cd rclone-*-linux-amd64 && \ + if [ "$TARGETARCH" = "arm64" ]; then \ + RCLONE_ARCH="arm64"; \ + elif [ "$TARGETARCH" = "arm" ]; then \ + RCLONE_ARCH="arm-v7"; \ + else \ + RCLONE_ARCH="amd64"; \ + fi && \ + curl -O https://downloads.rclone.org/rclone-current-linux-${RCLONE_ARCH}.zip && \ + unzip rclone-current-linux-${RCLONE_ARCH}.zip && \ + cd rclone-*-linux-${RCLONE_ARCH} && \ cp rclone /usr/local/bin/ && \ chmod 755 /usr/local/bin/rclone && \ cd .. && \ @@ -87,6 +98,8 @@ FROM alpine:3.19 ARG UID=1000 ARG GID=1000 ARG USERNAME=gomft +ARG TARGETOS +ARG TARGETARCH WORKDIR /app diff --git a/README.md b/README.md index 901f0a7..88e78b5 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,9 @@ GoMFT is a web-based managed file transfer application built with Go, leveraging Join our Discord server! + + Documentation +

> [!WARNING] diff --git a/components/dashboard.templ b/components/dashboard.templ index 9a8b6ac..2dbdd41 100644 --- a/components/dashboard.templ +++ b/components/dashboard.templ @@ -50,6 +50,11 @@ func isNewerVersionAvailable(current, latest string) bool { return false } + // Special case for DEV versions - always show update available + if current == "DEV" { + return true + } + // Strip 'v' prefix if present for comparison if strings.HasPrefix(current, "v") { current = current[1:] @@ -62,6 +67,12 @@ func isNewerVersionAvailable(current, latest string) bool { currentParts := strings.Split(current, ".") latestParts := strings.Split(latest, ".") + // Handle non-semver format in either version + if len(currentParts) < 2 || len(latestParts) < 2 { + // If format doesn't match semver pattern, do string comparison + return current != latest && latest != "" + } + // Compare major, minor, patch versions for i := 0; i < len(currentParts) && i < len(latestParts); i++ { // Parse to integers @@ -310,7 +321,7 @@ templ Dashboard(ctx context.Context, data DashboardData) { { data.CurrentVersion } - { data.LatestVersion } Available diff --git a/components/layout.templ b/components/layout.templ index eccb25f..ed9f2bf 100644 --- a/components/layout.templ +++ b/components/layout.templ @@ -364,7 +364,7 @@ templ LayoutWithContext(title string, ctx context.Context) { hx-get="/notifications/dropdown" hx-trigger="click once" hx-target="#notification-dropdown-content" - data-dropdown-placement="bottom-end" + data-dropdown-placement="bottom-start" > View notifications @@ -375,10 +375,10 @@ templ LayoutWithContext(title string, ctx context.Context) {