updated workflows (#377)
This commit is contained in:
parent
c4ccfd48f5
commit
f28115afc3
|
@ -0,0 +1,58 @@
|
||||||
|
name: Create Dev Version
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: "Version to create (format: 0.0.0)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create-dev-branch:
|
||||||
|
name: Create Dev Branch
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.PAT }} # Uses the Personal Access Token
|
||||||
|
|
||||||
|
- name: Validate version format
|
||||||
|
id: validate_version
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
|
echo "❌ ERROR: Version must be in '0.0.0' format."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ Version format validated: $VERSION"
|
||||||
|
|
||||||
|
- name: Check if branch already exists
|
||||||
|
id: check_branch
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
DEV_BRANCH="dev/v$VERSION"
|
||||||
|
|
||||||
|
if git ls-remote --exit-code origin "$DEV_BRANCH"; then
|
||||||
|
echo "❌ ERROR: Branch '$DEV_BRANCH' already exists!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ Branch '$DEV_BRANCH' does not exist."
|
||||||
|
|
||||||
|
- name: Create and push new dev branch
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
DEV_BRANCH="dev/v$VERSION"
|
||||||
|
|
||||||
|
# Fetch latest changes
|
||||||
|
git fetch origin main
|
||||||
|
|
||||||
|
# Create new branch from main
|
||||||
|
git checkout -b "$DEV_BRANCH" origin/main
|
||||||
|
|
||||||
|
# Push branch to remote
|
||||||
|
git push origin "$DEV_BRANCH"
|
||||||
|
|
||||||
|
echo "✅ Successfully created branch '$DEV_BRANCH'!"
|
|
@ -6,7 +6,7 @@ on:
|
||||||
- "main"
|
- "main"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test_frontend:
|
test_playwright:
|
||||||
name: Test Playwright
|
name: Test Playwright
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -31,7 +31,7 @@ jobs:
|
||||||
file: ./_docker/Dockerfile.playwright
|
file: ./_docker/Dockerfile.playwright
|
||||||
push: false
|
push: false
|
||||||
push_latest_to_registry:
|
push_latest_to_registry:
|
||||||
needs: [ test_frontend ]
|
needs: [ test_playwright ]
|
||||||
name: Push latest
|
name: Push latest
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -8,7 +8,7 @@ on:
|
||||||
- "stable/v[0-9]+.[0-9]+.[0-9]+"
|
- "stable/v[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test_frontend:
|
test_playwright:
|
||||||
name: Test Playwright
|
name: Test Playwright
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -30,7 +30,55 @@ jobs:
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./_docker/Dockerfile.playwright
|
file: ./_docker/Dockerfile.playwright-regular
|
||||||
|
push: false
|
||||||
|
test_playwright_proxy:
|
||||||
|
name: Test Playwright - regular
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3.0.0
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3.0.0
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
- working-directory: frontend
|
||||||
|
run: npm i && npm run build
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 'stable'
|
||||||
|
- working-directory: backend
|
||||||
|
run: go build -o filebrowser .
|
||||||
|
- name: Build
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./_docker/Dockerfile.playwright-proxy
|
||||||
|
push: false
|
||||||
|
test_playwright_noauth:
|
||||||
|
name: Test Playwright - regular
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3.0.0
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3.0.0
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
- working-directory: frontend
|
||||||
|
run: npm i && npm run build
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 'stable'
|
||||||
|
- working-directory: backend
|
||||||
|
run: go build -o filebrowser .
|
||||||
|
- name: Build
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./_docker/Dockerfile.playwright-noauth
|
||||||
push: false
|
push: false
|
||||||
push_pr_to_registry:
|
push_pr_to_registry:
|
||||||
name: Push PR
|
name: Push PR
|
||||||
|
@ -57,7 +105,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./_docker/Dockerfile
|
file: ./_docker/Dockerfile
|
||||||
push: true
|
push: false # Do not push the image for now
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
build-args: |
|
build-args: |
|
||||||
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
name: Promote Beta to Stable
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: "Version to promote (format: 0.0.0)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
promote-beta-to-stable:
|
||||||
|
name: Promote Beta to Stable
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.PAT }} # Uses Personal Access Token for branch operations
|
||||||
|
|
||||||
|
- name: Validate version format
|
||||||
|
id: validate_version
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
|
echo "❌ ERROR: Version must be in '0.0.0' format."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ Version format validated: $VERSION"
|
||||||
|
|
||||||
|
- name: Check if beta branch exists
|
||||||
|
id: check_beta_branch
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
BETA_BRANCH="beta/v$VERSION"
|
||||||
|
|
||||||
|
if ! git ls-remote --exit-code origin "$BETA_BRANCH"; then
|
||||||
|
echo "❌ ERROR: Beta branch '$BETA_BRANCH' does not exist!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ Beta branch '$BETA_BRANCH' exists."
|
||||||
|
|
||||||
|
- name: Check if stable branch already exists
|
||||||
|
id: check_stable_branch
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
STABLE_BRANCH="stable/v$VERSION"
|
||||||
|
|
||||||
|
if git ls-remote --exit-code origin "$STABLE_BRANCH"; then
|
||||||
|
echo "❌ ERROR: Stable branch '$STABLE_BRANCH' already exists!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ Stable branch '$STABLE_BRANCH' does not exist."
|
||||||
|
|
||||||
|
- name: Create and push new stable branch
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
BETA_BRANCH="beta/v$VERSION"
|
||||||
|
STABLE_BRANCH="stable/v$VERSION"
|
||||||
|
|
||||||
|
# Fetch latest changes
|
||||||
|
git fetch origin "$BETA_BRANCH"
|
||||||
|
|
||||||
|
# Create new stable branch from beta branch
|
||||||
|
git checkout -b "$STABLE_BRANCH" origin/"$BETA_BRANCH"
|
||||||
|
|
||||||
|
# Push new stable branch to remote
|
||||||
|
git push origin "$STABLE_BRANCH"
|
||||||
|
|
||||||
|
echo "✅ Successfully created stable branch '$STABLE_BRANCH' from '$BETA_BRANCH'."
|
||||||
|
|
||||||
|
- name: Merge beta into stable
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
BETA_BRANCH="beta/v$VERSION"
|
||||||
|
STABLE_BRANCH="stable/v$VERSION"
|
||||||
|
|
||||||
|
# Checkout stable branch
|
||||||
|
git checkout "$STABLE_BRANCH"
|
||||||
|
|
||||||
|
# Merge beta into stable
|
||||||
|
git merge --no-ff "origin/$BETA_BRANCH" -m "Merge $BETA_BRANCH into $STABLE_BRANCH"
|
||||||
|
|
||||||
|
# Push merge changes
|
||||||
|
git push origin "$STABLE_BRANCH"
|
||||||
|
|
||||||
|
echo "✅ Successfully merged '$BETA_BRANCH' into '$STABLE_BRANCH'."
|
||||||
|
|
||||||
|
- name: Delete beta branch after successful merge
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
BETA_BRANCH="beta/v$VERSION"
|
||||||
|
|
||||||
|
# Delete beta branch locally and remotely
|
||||||
|
git branch -d "$BETA_BRANCH"
|
||||||
|
git push origin --delete "$BETA_BRANCH"
|
||||||
|
|
||||||
|
echo "✅ Successfully deleted '$BETA_BRANCH'."
|
||||||
|
|
||||||
|
- name: Create Pull Request to Main
|
||||||
|
uses: peter-evans/create-pull-request@v6
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.PAT }}
|
||||||
|
commit-message: "Promote stable/v${{ github.event.inputs.version }} to main"
|
||||||
|
title: "Promote stable/v${{ github.event.inputs.version }} to main"
|
||||||
|
body: "This PR promotes stable/v${{ github.event.inputs.version }} to the main branch."
|
||||||
|
base: main
|
||||||
|
branch: stable/v${{ github.event.inputs.version }}
|
||||||
|
delete-branch: false
|
|
@ -0,0 +1,99 @@
|
||||||
|
name: Promote Dev to Beta
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: "Version to promote (format: 0.0.0)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
promote-dev-to-beta:
|
||||||
|
name: Promote Dev to Beta
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.PAT }} # Uses the Personal Access Token
|
||||||
|
|
||||||
|
- name: Validate version format
|
||||||
|
id: validate_version
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
|
echo "❌ ERROR: Version must be in 'v0.0.0' format."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ Version format validated: $VERSION"
|
||||||
|
|
||||||
|
- name: Check if dev branch exists
|
||||||
|
id: check_dev_branch
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
DEV_BRANCH="dev/v$VERSION"
|
||||||
|
|
||||||
|
if ! git ls-remote --exit-code origin "$DEV_BRANCH"; then
|
||||||
|
echo "❌ ERROR: Dev branch '$DEV_BRANCH' does not exist!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ Dev branch '$DEV_BRANCH' exists."
|
||||||
|
|
||||||
|
- name: Check if beta branch already exists
|
||||||
|
id: check_beta_branch
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
BETA_BRANCH="beta/v$VERSION"
|
||||||
|
|
||||||
|
if git ls-remote --exit-code origin "$BETA_BRANCH"; then
|
||||||
|
echo "❌ ERROR: Beta branch '$BETA_BRANCH' already exists!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ Beta branch '$BETA_BRANCH' does not exist."
|
||||||
|
|
||||||
|
- name: Create and push new beta branch
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
DEV_BRANCH="dev/v$VERSION"
|
||||||
|
BETA_BRANCH="beta/v$VERSION"
|
||||||
|
|
||||||
|
# Fetch latest changes
|
||||||
|
git fetch origin "$DEV_BRANCH"
|
||||||
|
|
||||||
|
# Create new beta branch from dev branch
|
||||||
|
git checkout -b "$BETA_BRANCH" origin/"$DEV_BRANCH"
|
||||||
|
|
||||||
|
# Push new beta branch to remote
|
||||||
|
git push origin "$BETA_BRANCH"
|
||||||
|
|
||||||
|
echo "✅ Successfully created beta branch '$BETA_BRANCH' from '$DEV_BRANCH'."
|
||||||
|
|
||||||
|
- name: Merge dev into beta
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
DEV_BRANCH="dev/v$VERSION"
|
||||||
|
BETA_BRANCH="beta/v$VERSION"
|
||||||
|
|
||||||
|
# Checkout beta branch
|
||||||
|
git checkout "$BETA_BRANCH"
|
||||||
|
|
||||||
|
# Merge dev into beta
|
||||||
|
git merge --no-ff "origin/$DEV_BRANCH" -m "Merge $DEV_BRANCH into $BETA_BRANCH"
|
||||||
|
|
||||||
|
# Push merge changes
|
||||||
|
git push origin "$BETA_BRANCH"
|
||||||
|
|
||||||
|
echo "✅ Successfully merged '$DEV_BRANCH' into '$BETA_BRANCH'."
|
||||||
|
|
||||||
|
- name: Delete dev branch after successful merge
|
||||||
|
run: |
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
DEV_BRANCH="dev/v$VERSION"
|
||||||
|
|
||||||
|
# Delete dev branch locally and remotely
|
||||||
|
git branch -d "$DEV_BRANCH"
|
||||||
|
git push origin --delete "$DEV_BRANCH"
|
||||||
|
|
||||||
|
echo "✅ Successfully deleted '$DEV_BRANCH'."
|
|
@ -9,8 +9,8 @@ permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test_frontend:
|
test_playwright:
|
||||||
name: Test Playwright
|
name: Test Playwright - regular
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -31,10 +31,10 @@ jobs:
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./_docker/Dockerfile.playwright
|
file: ./_docker/Dockerfile.playwright-regular
|
||||||
push: false
|
push: false
|
||||||
create_release_tag:
|
create_release_tag:
|
||||||
needs: [ test_frontend ]
|
needs: [ test_playwright ]
|
||||||
name: Create Release
|
name: Create Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -64,44 +64,3 @@ jobs:
|
||||||
draft: false
|
draft: false
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
name: ${{ steps.extract_branch.outputs.tag_name }}
|
name: ${{ steps.extract_branch.outputs.tag_name }}
|
||||||
|
|
||||||
push_release_to_registry:
|
|
||||||
needs: [ test_frontend ]
|
|
||||||
name: Push release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3.0.0
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3.0.0
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: gtstef/filebrowser
|
|
||||||
- name: Strip v from version number
|
|
||||||
id: modify-json
|
|
||||||
run: |
|
|
||||||
JSON="${{ steps.meta.outputs.tags }}"
|
|
||||||
# Use jq to remove 'v' from the version field
|
|
||||||
JSON=$(echo "$JSON" | sed 's/filebrowser:beta\/v/filebrowser:beta_v/')
|
|
||||||
echo "cleaned_tag=$JSON" >> $GITHUB_OUTPUT
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
build-args: |
|
|
||||||
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
|
||||||
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
file: ./_docker/Dockerfile
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.modify-json.outputs.cleaned_tag }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
|
|
@ -29,12 +29,14 @@ jobs:
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: gtstef/filebrowser
|
images: gtstef/filebrowser
|
||||||
- name: Strip v from version number
|
- name: modify version names
|
||||||
id: modify-json
|
id: modify-json
|
||||||
run: |
|
run: |
|
||||||
JSON="${{ steps.meta.outputs.tags }}"
|
JSON="${{ steps.meta.outputs.tags }}"
|
||||||
# Use jq to remove 'v' from the version field
|
# Use jq to remove 'v' from the version field
|
||||||
JSON=$(echo "$JSON" | sed 's/filebrowser:dev\/v/filebrowser:dev_v/')
|
JSON=$(echo "$JSON" | sed 's/filebrowser:dev-v/filebrowser:/')
|
||||||
|
JSON=$(echo "$JSON" | sed -E 's/(filebrowser:[0-9]+\.[0-9]+\.[0-9]+)/\1-dev/g')
|
||||||
|
JSON="$JSON,gtstef/filebrowser:dev"
|
||||||
echo "cleaned_tag=$JSON" >> $GITHUB_OUTPUT
|
echo "cleaned_tag=$JSON" >> $GITHUB_OUTPUT
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
|
|
|
@ -9,7 +9,7 @@ permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test_frontend:
|
test_playwright:
|
||||||
name: Test Playwright
|
name: Test Playwright
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -31,10 +31,10 @@ jobs:
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./_docker/Dockerfile.playwright
|
file: ./_docker/Dockerfile.playwright-regular
|
||||||
push: false
|
push: false
|
||||||
create_release_tag:
|
create_release_tag:
|
||||||
needs: [ test_frontend ]
|
needs: [ test_playwright ]
|
||||||
name: Create Release
|
name: Create Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -63,44 +63,3 @@ jobs:
|
||||||
draft: false
|
draft: false
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
name: ${{ steps.extract_branch.outputs.tag_name }}
|
name: ${{ steps.extract_branch.outputs.tag_name }}
|
||||||
|
|
||||||
push_release_to_registry:
|
|
||||||
needs: [ test_frontend ]
|
|
||||||
name: Push release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3.0.0
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3.0.0
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: gtstef/filebrowser
|
|
||||||
- name: Strip v from version number
|
|
||||||
id: modify-json
|
|
||||||
run: |
|
|
||||||
JSON="${{ steps.meta.outputs.tags }}"
|
|
||||||
# Use jq to remove 'v' from the version field
|
|
||||||
JSON=$(echo "$JSON" | sed 's/filebrowser:stable\/v/filebrowser:/')
|
|
||||||
echo "cleaned_tag=$JSON" >> $GITHUB_OUTPUT
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
build-args: |
|
|
||||||
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
|
||||||
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
file: ./_docker/Dockerfile
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.modify-json.outputs.cleaned_tag }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
|
|
@ -29,3 +29,50 @@ jobs:
|
||||||
workdir: backend
|
workdir: backend
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
push_release_to_registry:
|
||||||
|
name: Push release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3.0.0
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3.0.0
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: gtstef/filebrowser
|
||||||
|
- name: Modify tags (strip 'v' and add 'beta' if needed)
|
||||||
|
id: modify-json
|
||||||
|
run: |
|
||||||
|
JSON="${{ steps.meta.outputs.tags }}"
|
||||||
|
# Remove 'v' from version tags
|
||||||
|
JSON=$(echo "$JSON" | sed 's/filebrowser:v/filebrowser:/')
|
||||||
|
# If the tag includes "beta", append "filebrowser:beta"
|
||||||
|
if echo "$JSON" | grep -q "beta"; then
|
||||||
|
JSON="$JSON,gtstef/filebrowser:beta"
|
||||||
|
fi
|
||||||
|
if echo "$JSON" | grep -q "stable"; then
|
||||||
|
JSON="$JSON,gtstef/filebrowser:stable"
|
||||||
|
fi
|
||||||
|
echo "cleaned_tag=$JSON" >> $GITHUB_OUTPUT
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
build-args: |
|
||||||
|
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
||||||
|
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
file: ./_docker/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.modify-json.outputs.cleaned_tag }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
|
@ -0,0 +1,8 @@
|
||||||
|
FROM gtstef/playwright-base
|
||||||
|
WORKDIR /app
|
||||||
|
COPY [ "./_docker/src/noauth/", "./" ]
|
||||||
|
WORKDIR /app/frontend
|
||||||
|
COPY [ "./frontend/", "./" ]
|
||||||
|
WORKDIR /app/backend/
|
||||||
|
COPY [ "./backend/filebrowser", "./"]
|
||||||
|
RUN ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
|
|
@ -0,0 +1,10 @@
|
||||||
|
FROM gtstef/playwright-base
|
||||||
|
WORKDIR /app
|
||||||
|
COPY [ "./_docker/src/proxy/", "./" ]
|
||||||
|
WORKDIR /app/frontend
|
||||||
|
COPY [ "./frontend/", "./" ]
|
||||||
|
WORKDIR /app/backend/
|
||||||
|
COPY [ "./backend/filebrowser", "./"]
|
||||||
|
RUN apt update && apt install nginx -y
|
||||||
|
RUN mv default.conf /etc/nginx/conf.d/default.conf
|
||||||
|
RUN nginx & ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
|
|
@ -1,6 +1,8 @@
|
||||||
FROM gtstef/playwright-base
|
FROM gtstef/playwright-base
|
||||||
|
WORKDIR /app
|
||||||
|
COPY [ "./_docker/src/regular/", "./" ]
|
||||||
WORKDIR /app/frontend
|
WORKDIR /app/frontend
|
||||||
COPY [ "./frontend/", "./" ]
|
COPY [ "./frontend/", "./" ]
|
||||||
WORKDIR /app/backend/
|
WORKDIR /app/backend/
|
||||||
COPY [ "./backend/filebrowser*", "./"]
|
COPY [ "./backend/filebrowser*", "./"]
|
||||||
RUN ./filebrowser -c filebrowser-playwright.yaml & sleep 2 && cd ../frontend && npx playwright test
|
RUN ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
|
|
@ -3,13 +3,13 @@ services:
|
||||||
image: nginx
|
image: nginx
|
||||||
container_name: nginx-proxy-auth
|
container_name: nginx-proxy-auth
|
||||||
ports:
|
ports:
|
||||||
- "8080:80"
|
- "80:80"
|
||||||
volumes:
|
volumes:
|
||||||
- ./src/default.conf:/etc/nginx/conf.d/default.conf
|
- ./src/proxy/backend/default.conf:/etc/nginx/conf.d/default.conf
|
||||||
filebrowser:
|
filebrowser:
|
||||||
volumes:
|
volumes:
|
||||||
- '../frontend:/home/frontend'
|
- '../frontend:/home/frontend'
|
||||||
- "./src/config.yaml:/home/filebrowser/config.yaml"
|
- "./src/proxy/backend/config.yaml:/home/filebrowser/config.yaml"
|
||||||
build:
|
build:
|
||||||
context: ../
|
context: ../
|
||||||
dockerfile: ./_docker/Dockerfile
|
dockerfile: ./_docker/Dockerfile
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
server:
|
|
||||||
port: 80
|
|
||||||
baseURL: "/"
|
|
||||||
root: "../frontend/tests/playwright-files"
|
|
||||||
auth:
|
|
||||||
method: proxy
|
|
||||||
header: X-Username
|
|
||||||
signup: false
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
server:
|
||||||
|
port: 80
|
||||||
|
baseURL: "/"
|
||||||
|
root: "../frontend/tests/playwright-files"
|
||||||
|
auth:
|
||||||
|
signup: false
|
||||||
|
methods:
|
||||||
|
noauth: true
|
||||||
|
frontend:
|
||||||
|
name: "Graham's Filebrowser"
|
||||||
|
disableDefaultLinks: true
|
||||||
|
externalLinks:
|
||||||
|
- text: "A playwright test"
|
||||||
|
url: "https://playwright.dev/"
|
||||||
|
title: "Playwright"
|
|
@ -0,0 +1,47 @@
|
||||||
|
import { defineConfig, devices } from "@playwright/test";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read environment variables from file.
|
||||||
|
* https://github.com/motdotla/dotenv
|
||||||
|
*/
|
||||||
|
// require('dotenv').config();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See https://playwright.dev/docs/test-configuration.
|
||||||
|
*/
|
||||||
|
export default defineConfig({
|
||||||
|
//globalSetup: "./global-setup",
|
||||||
|
timeout: 6000,
|
||||||
|
testDir: "./tests-proxy",
|
||||||
|
/* Run tests in files in parallel */
|
||||||
|
fullyParallel: false,
|
||||||
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||||
|
forbidOnly: false,
|
||||||
|
/* Retry on CI only */
|
||||||
|
retries: 2,
|
||||||
|
/* Opt out of parallel tests on CI. */
|
||||||
|
workers: 1, // required for now! todo parallel some tests
|
||||||
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||||
|
reporter: "line",
|
||||||
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
|
use: {
|
||||||
|
actionTimeout: 5000,
|
||||||
|
//storageState: "loginAuth.json",
|
||||||
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||||
|
baseURL: "http://127.0.0.1",
|
||||||
|
|
||||||
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
|
trace: "on-first-retry",
|
||||||
|
|
||||||
|
/* Set default locale to English (US) */
|
||||||
|
locale: "en-US",
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Configure projects for major browsers */
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: "firefox",
|
||||||
|
use: { ...devices["Desktop Firefox"] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
|
@ -0,0 +1,35 @@
|
||||||
|
server:
|
||||||
|
port: 8080
|
||||||
|
baseURL: "/"
|
||||||
|
root: "../frontend/tests/playwright-files"
|
||||||
|
frontend:
|
||||||
|
name: "Graham's Filebrowser"
|
||||||
|
disableDefaultLinks: true
|
||||||
|
externalLinks:
|
||||||
|
- text: "A playwright test"
|
||||||
|
url: "https://playwright.dev/"
|
||||||
|
title: "Playwright"
|
||||||
|
auth:
|
||||||
|
signup: false
|
||||||
|
methods:
|
||||||
|
password:
|
||||||
|
enabled: false
|
||||||
|
minLength: 0
|
||||||
|
proxy:
|
||||||
|
enabled: true
|
||||||
|
header: "X-Username"
|
||||||
|
createUser: true
|
||||||
|
|
||||||
|
userDefaults:
|
||||||
|
darkMode: true
|
||||||
|
disableSettings: false
|
||||||
|
scope: "."
|
||||||
|
singleClick: false
|
||||||
|
permissions:
|
||||||
|
admin: false
|
||||||
|
create: false
|
||||||
|
rename: false
|
||||||
|
modify: false
|
||||||
|
delete: false
|
||||||
|
share: false
|
||||||
|
download: false
|
|
@ -3,7 +3,7 @@ server {
|
||||||
server_name localhost 127.0.0.1;
|
server_name localhost 127.0.0.1;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://filebrowser;
|
proxy_pass http://localhost:8080;
|
||||||
proxy_set_header X-Username "proxy-user";
|
proxy_set_header X-Username "proxy-user";
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@ -0,0 +1,47 @@
|
||||||
|
import { defineConfig, devices } from "@playwright/test";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read environment variables from file.
|
||||||
|
* https://github.com/motdotla/dotenv
|
||||||
|
*/
|
||||||
|
// require('dotenv').config();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See https://playwright.dev/docs/test-configuration.
|
||||||
|
*/
|
||||||
|
export default defineConfig({
|
||||||
|
//globalSetup: "./global-setup",
|
||||||
|
timeout: 6000,
|
||||||
|
testDir: "./tests-proxy",
|
||||||
|
/* Run tests in files in parallel */
|
||||||
|
fullyParallel: false,
|
||||||
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||||
|
forbidOnly: false,
|
||||||
|
/* Retry on CI only */
|
||||||
|
retries: 2,
|
||||||
|
/* Opt out of parallel tests on CI. */
|
||||||
|
workers: 1, // required for now! todo parallel some tests
|
||||||
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||||
|
reporter: "line",
|
||||||
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
|
use: {
|
||||||
|
actionTimeout: 5000,
|
||||||
|
//storageState: "loginAuth.json",
|
||||||
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||||
|
baseURL: "http://127.0.0.1",
|
||||||
|
|
||||||
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
|
trace: "on-first-retry",
|
||||||
|
|
||||||
|
/* Set default locale to English (US) */
|
||||||
|
locale: "en-US",
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Configure projects for major browsers */
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: "firefox",
|
||||||
|
use: { ...devices["Desktop Firefox"] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
|
@ -2,9 +2,6 @@ server:
|
||||||
port: 80
|
port: 80
|
||||||
baseURL: "/"
|
baseURL: "/"
|
||||||
root: "../frontend/tests/playwright-files"
|
root: "../frontend/tests/playwright-files"
|
||||||
auth:
|
|
||||||
method: password
|
|
||||||
signup: false
|
|
||||||
frontend:
|
frontend:
|
||||||
name: "Graham's Filebrowser"
|
name: "Graham's Filebrowser"
|
||||||
disableDefaultLinks: true
|
disableDefaultLinks: true
|
|
@ -0,0 +1,55 @@
|
||||||
|
import { test, expect } from "@playwright/test";
|
||||||
|
|
||||||
|
test("blob file preview", async ({ page, context }) => {
|
||||||
|
await page.goto("/files/");
|
||||||
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - playwright-files");
|
||||||
|
await page.locator('a[aria-label="file.tar.gz"]').waitFor({ state: 'visible' });
|
||||||
|
await page.locator('a[aria-label="file.tar.gz"]').dblclick();
|
||||||
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - file.tar.gz");
|
||||||
|
await page.locator('button[title="Close"]').click();
|
||||||
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - playwright-files");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("text file editor", async ({ page, context }) => {
|
||||||
|
await page.goto("/files/");
|
||||||
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - playwright-files");
|
||||||
|
await page.locator('a[aria-label="copyme.txt"]').waitFor({ state: 'visible' });
|
||||||
|
await page.locator('a[aria-label="copyme.txt"]').dblclick();
|
||||||
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - copyme.txt");
|
||||||
|
const firstLineText = await page.locator('.ace_text-layer .ace_line').first().textContent();
|
||||||
|
expect(firstLineText).toBe('test file for playwright');
|
||||||
|
await page.locator('button[title="Close"]').click();
|
||||||
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - playwright-files");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("navigate folders", async ({ page, context }) => {
|
||||||
|
await page.goto("/files/");
|
||||||
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - playwright-files");
|
||||||
|
await page.locator('a[aria-label="myfolder"]').waitFor({ state: 'visible' });
|
||||||
|
await page.locator('a[aria-label="myfolder"]').dblclick();
|
||||||
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - myfolder");
|
||||||
|
await page.locator('a[aria-label="testdata"]').waitFor({ state: 'visible' });
|
||||||
|
await page.locator('a[aria-label="testdata"]').dblclick();
|
||||||
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - testdata");
|
||||||
|
await page.locator('a[aria-label="gray-sample.jpg"]').waitFor({ state: 'visible' });
|
||||||
|
await page.locator('a[aria-label="gray-sample.jpg"]').dblclick();
|
||||||
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - gray-sample.jpg");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("navigating images", async ({ page, context }) => {
|
||||||
|
await page.goto("/files/myfolder/testdata/20130612_142406.jpg");
|
||||||
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - 20130612_142406.jpg");
|
||||||
|
await page.locator('button[aria-label="Previous"]').waitFor({ state: 'hidden' });
|
||||||
|
await page.mouse.move(100, 100);
|
||||||
|
await page.locator('button[aria-label="Next"]').waitFor({ state: 'visible' });
|
||||||
|
await page.locator('button[aria-label="Next"]').click();
|
||||||
|
// went to next image
|
||||||
|
await expect(page).toHaveTitle("Graham's Filebrowser - Files - gray-sample.jpg");
|
||||||
|
await page.locator('button[aria-label="Previous"]').waitFor({ state: 'hidden' });
|
||||||
|
await page.locator('button[aria-label="Next"]').waitFor({ state: 'hidden' });
|
||||||
|
await page.mouse.move(100, 100);
|
||||||
|
await page.locator('button[aria-label="Next"]').waitFor({ state: 'visible' });
|
||||||
|
//await page.locator('button[aria-label="Next"]').click();
|
||||||
|
// went to next image
|
||||||
|
//await expect(page).toHaveTitle("Graham's Filebrowser - Files - IMG_2578.JPG");
|
||||||
|
});
|
6
makefile
6
makefile
|
@ -53,7 +53,11 @@ test-frontend:
|
||||||
|
|
||||||
test-playwright: run-frontend
|
test-playwright: run-frontend
|
||||||
cd backend && GOOS=linux go build -o filebrowser . && cd .. && \
|
cd backend && GOOS=linux go build -o filebrowser . && cd .. && \
|
||||||
docker build -t filebrowser-playwright-tests -f _docker/Dockerfile.playwright .
|
docker build -t filebrowser-playwright-tests -f _docker/Dockerfile.playwright-regular . && \
|
||||||
|
docker run --rm --name filebrowser-playwright-tests filebrowser-playwright-tests && \
|
||||||
|
docker build -t filebrowser-playwright-tests -f _docker/Dockerfile.playwright-noauth . && \
|
||||||
|
docker run --rm --name filebrowser-playwright-tests filebrowser-playwright-tests && \
|
||||||
|
docker build -t filebrowser-playwright-tests -f _docker/Dockerfile.playwright-proxy . && \
|
||||||
docker run --rm --name filebrowser-playwright-tests filebrowser-playwright-tests
|
docker run --rm --name filebrowser-playwright-tests filebrowser-playwright-tests
|
||||||
|
|
||||||
# Run on a windows machine!
|
# Run on a windows machine!
|
||||||
|
|
Loading…
Reference in New Issue