diff --git a/.dockerignore b/.dockerignore index 784bd04..d0b7004 100644 --- a/.dockerignore +++ b/.dockerignore @@ -21,7 +21,7 @@ docker-compose*.yml Dockerfile # CI/CD -.github +.gitea # Testing tests diff --git a/.gitattributes b/.gitattributes index 4da48a8..82f3c2c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,4 +8,4 @@ CHANGELOG.md export-ignore README.md export-ignore -.github/workflows/browser-tests.yml export-ignore +.gitea export-ignore diff --git a/.github/workflows/docker.yml b/.gitea/workflows/docker.yml similarity index 64% rename from .github/workflows/docker.yml rename to .gitea/workflows/docker.yml index dcbc0d7..d2ad94f 100644 --- a/.github/workflows/docker.yml +++ b/.gitea/workflows/docker.yml @@ -73,19 +73,21 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to GitHub Container Registry - if: github.event_name != 'pull_request' + # Gitea's job token cannot publish packages yet: REGISTRY_TOKEN is an access token with + # package write rights, owned by the account that pushes (gitea.actor). + - name: Log in to the Gitea container registry + if: gitea.event_name != 'pull_request' uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + registry: gitea.nonameweb.ch + username: ${{ gitea.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository }} + images: gitea.nonameweb.ch/nonameweb/sealshare tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} @@ -98,21 +100,27 @@ jobs: with: context: . platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} + push: ${{ gitea.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=registry,ref=gitea.nonameweb.ch/nonameweb/sealshare:buildcache + cache-to: ${{ gitea.event_name != 'pull_request' && 'type=registry,ref=gitea.nonameweb.ch/nonameweb/sealshare:buildcache,mode=max' || '' }} release: runs-on: ubuntu-latest needs: build-and-push - if: startsWith(github.ref, 'refs/tags/v') + if: startsWith(gitea.ref, 'refs/tags/v') steps: - name: Checkout code uses: actions/checkout@v6 - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 + - name: Take the release notes from the changelog + run: | + version="${{ gitea.ref_name }}" + awk -v heading="## [${version#v}]" 'index($0, heading) == 1 { found = 1; next } found && /^## \[/ { exit } found { print }' CHANGELOG.md > release-notes.md + test -s release-notes.md + + - name: Create the Gitea release + uses: https://gitea.com/actions/gitea-release-action@v1 with: - generate_release_notes: true + body_path: release-notes.md diff --git a/.github/workflows/lint.yml b/.gitea/workflows/lint.yml similarity index 96% rename from .github/workflows/lint.yml rename to .gitea/workflows/lint.yml index 4c476e0..93dc465 100644 --- a/.github/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -44,4 +44,4 @@ jobs: # commit_options: '--no-verify' # file_pattern: | # **/* - # !.github/workflows/* + # !.gitea/workflows/* diff --git a/.github/workflows/tests.yml b/.gitea/workflows/tests.yml similarity index 100% rename from .github/workflows/tests.yml rename to .gitea/workflows/tests.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 5796273..82086a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- SealShare moved from GitHub to Gitea: the source is at https://gitea.nonameweb.ch/noNameWEB/SealShare, and the Docker image is published as `gitea.nonameweb.ch/nonameweb/sealshare`. Images at `ghcr.io/surtic86/sealshare` are no longer updated — change `image:` in your `docker-compose.yml` to the new name to keep receiving releases. - The interface is rebuilt on [Livewire Material](https://gitea.nonameweb.ch/noNameWEB/livewire-material), a Material 3 Expressive component library, replacing Mary UI and DaisyUI. Every page — upload, share created, download, sign-in, settings, admin and the setup wizard — uses its components, in a colour scheme generated from SealShare's indigo. - The theme follows the system's light or dark setting until a user picks Light, Dark or System in Settings → Appearance, or from the account menu. A theme chosen in 1.x is kept. - A floating toolbar centred at the bottom of every page replaces the sidebar and header layouts. Signed-in users reach Upload and the admin pages from it, and Settings, the theme and Log out from its account menu. The site's name and logo head the upload and download pages. @@ -105,9 +106,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Dark themed UI built with Livewire, Alpine.js, Tailwind CSS and DaisyUI. - Docker images published to `ghcr.io/surtic86/sealshare`, served by FrankenPHP via Laravel Octane. -[Unreleased]: https://github.com/surtic86/SealShare/compare/v2.0.0...HEAD -[2.0.0]: https://github.com/surtic86/SealShare/compare/v1.2.0...v2.0.0 -[1.2.0]: https://github.com/surtic86/SealShare/compare/v1.1.0...v1.2.0 -[1.1.0]: https://github.com/surtic86/SealShare/compare/v1.0.1...v1.1.0 -[1.0.1]: https://github.com/surtic86/SealShare/compare/v1.0.0...v1.0.1 -[1.0.0]: https://github.com/surtic86/SealShare/releases/tag/v1.0.0 +[Unreleased]: https://gitea.nonameweb.ch/noNameWEB/SealShare/compare/v2.0.0...main +[2.0.0]: https://gitea.nonameweb.ch/noNameWEB/SealShare/releases/tag/v2.0.0 diff --git a/Dockerfile b/Dockerfile index a173593..d8c022a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,7 +41,7 @@ RUN npm run build FROM dunglas/frankenphp:php8.5-alpine AS production LABEL maintainer="surtic86" -LABEL org.opencontainers.image.source="https://github.com/surtic86/SealShare" +LABEL org.opencontainers.image.source="https://gitea.nonameweb.ch/noNameWEB/SealShare" LABEL org.opencontainers.image.description="Self-hosted encrypted file sharing" # Install required PHP extensions @@ -84,7 +84,7 @@ COPY --from=vendor /app/vendor ./vendor COPY --from=assets /app/public/build ./public/build # Remove dev/build files and stale cache not needed in production -RUN rm -rf node_modules tests .github docker/dev.Dockerfile docker/dev-entrypoint.sh .env .env.example \ +RUN rm -rf node_modules tests .gitea docker/dev.Dockerfile docker/dev-entrypoint.sh .env .env.example \ bootstrap/cache/*.php \ && mkdir -p storage/app/shares storage/app/public storage/framework/cache \ storage/framework/sessions storage/framework/testing storage/framework/views \ diff --git a/README.md b/README.md index 0634a98..7db7c5a 100644 --- a/README.md +++ b/README.md @@ -68,11 +68,11 @@ The app is available at `http://localhost:8000` with Vite HMR on port `5173`. ```bash mkdir sealshare && cd sealshare -curl -O https://raw.githubusercontent.com/surtic86/SealShare/main/docker-compose.example.yml +curl -O https://gitea.nonameweb.ch/noNameWEB/SealShare/raw/branch/main/docker-compose.example.yml cp docker-compose.example.yml docker-compose.yml # Generate an app key and paste it into docker-compose.yml -docker run --rm ghcr.io/surtic86/sealshare:latest php artisan key:generate --show +docker run --rm gitea.nonameweb.ch/nonameweb/sealshare:latest php artisan key:generate --show # Edit docker-compose.yml — set APP_KEY, APP_URL, and SERVER_NAME # Then start: @@ -114,7 +114,7 @@ Behind a reverse proxy, raise its request body limit and read timeout as well (n ### Manual (without Docker) ```bash -git clone https://github.com/surtic86/SealShare.git +git clone https://gitea.nonameweb.ch/noNameWEB/SealShare.git cd SealShare composer install --no-dev --optimize-autoloader diff --git a/docker-compose.example.yml b/docker-compose.example.yml index 4bd1900..031ecc5 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -18,7 +18,7 @@ services: # SealShare Application (FrankenPHP/Octane) # ------------------------------------------ app: - image: ghcr.io/surtic86/sealshare:latest + image: gitea.nonameweb.ch/nonameweb/sealshare:latest restart: unless-stopped ports: - "80:80" # HTTP @@ -71,7 +71,7 @@ services: # Scheduler - Runs cleanup for expired shares # ------------------------------------------ scheduler: - image: ghcr.io/surtic86/sealshare:latest + image: gitea.nonameweb.ch/nonameweb/sealshare:latest restart: unless-stopped entrypoint: ["php", "artisan", "schedule:work"] volumes: diff --git a/docker-compose.yml b/docker-compose.yml index 1d1d181..04de93a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: app: - image: ghcr.io/surtic86/sealshare:latest + image: gitea.nonameweb.ch/nonameweb/sealshare:latest build: context: . dockerfile: Dockerfile @@ -47,7 +47,7 @@ services: retries: 3 scheduler: - image: ghcr.io/surtic86/sealshare:latest + image: gitea.nonameweb.ch/nonameweb/sealshare:latest build: context: . dockerfile: Dockerfile diff --git a/tests/Feature/GiteaOnlyTest.php b/tests/Feature/GiteaOnlyTest.php new file mode 100644 index 0000000..0d577a1 --- /dev/null +++ b/tests/Feature/GiteaOnlyTest.php @@ -0,0 +1,44 @@ + str($path)->after(base_path().'/')->toString(), glob(base_path('.gitea/workflows/*.yml'))), + ]; + + foreach ($files as $file) { + expect(file_get_contents(base_path($file)))->not->toMatch('/github|ghcr\.io/i', "{$file} still refers to GitHub"); + } + + expect(base_path('.github'))->not->toBeDirectory() + ->and(glob(base_path('.gitea/workflows/*.yml')))->not->toBeEmpty(); +}); + +test('the website installs SealShare from Gitea', function () { + preg_match('/]*id="install".*?<\/section>/s', file_get_contents(base_path('website/index.html')), $install); + + expect($install[0])->not->toMatch('/github|ghcr\.io/i') + ->toContain('gitea.nonameweb.ch/nonameweb/sealshare:latest') + ->toContain('https://gitea.nonameweb.ch/noNameWEB/SealShare/raw/branch/main/docker-compose.example.yml'); +}); + +test('images are published to the Gitea registry and releases are made on Gitea', function () { + $workflow = file_get_contents(base_path('.gitea/workflows/docker.yml')); + + expect($workflow) + ->toContain('registry: gitea.nonameweb.ch') + ->toContain('images: gitea.nonameweb.ch/nonameweb/sealshare') + ->toContain('password: ${{ secrets.REGISTRY_TOKEN }}') + ->toContain('uses: https://gitea.com/actions/gitea-release-action@v1'); +}); diff --git a/website/index.html b/website/index.html index 55780f4..934b759 100644 --- a/website/index.html +++ b/website/index.html @@ -547,11 +547,11 @@
Production, with Docker Compose
mkdir sealshare && cd sealshare
-curl -O https://raw.githubusercontent.com/surtic86/SealShare/main/docker-compose.example.yml
+curl -O https://gitea.nonameweb.ch/noNameWEB/SealShare/raw/branch/main/docker-compose.example.yml
 cp docker-compose.example.yml docker-compose.yml
 
 # Generate an app key and paste it into docker-compose.yml
-docker run --rm ghcr.io/surtic86/sealshare:latest php artisan key:generate --show
+docker run --rm gitea.nonameweb.ch/nonameweb/sealshare:latest php artisan key:generate --show
 
 # Edit docker-compose.yml — set APP_KEY, APP_URL, and SERVER_NAME
 # Then start: