diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 935adc1f..ba1e56c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,78 +1,55 @@ -name: Build for Release -on: [release] +name: Publish containers for release + +on: + release: + types: [published] jobs: - release-linux-386: - name: release linux/386 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: compile and release - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOARCH: '386' - GOOS: linux - EXTRA_FILES: 'license' - release-linux-amd64: - name: release linux/amd64 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: compile and release - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOARCH: amd64 - GOOS: linux - EXTRA_FILES: 'license' - release-darwin-amd64: - name: release darwin/amd64 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: compile and release - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOARCH: amd64 - GOOS: darwin - EXTRA_FILES: 'license' - release-windows-386: - name: release windows/386 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: compile and release - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOARCH: '386' - GOOS: windows - EXTRA_FILES: 'license' - release-windows-amd64: - name: release windows/amd64 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: compile and release - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOARCH: amd64 - GOOS: windows - EXTRA_FILES: 'license' - docker: - name: publish to docker + push_to_registries: + name: Push Docker image to multiple registries runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + id-token: write steps: - - uses: actions/checkout@master - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to Docker Hub - uses: docker/login-action@v2 + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + images: | + spacebinorg/spirit + ghcr.io/${{ github.repository }} + - name: Build and push Docker images - uses: docker/build-push-action@v3.2.0 + id: push + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/README.md b/README.md index f20e0881..b4b00801 100644 --- a/README.md +++ b/README.md @@ -16,22 +16,22 @@ Spacebin is a modern Pastebin server implemented in Go and maintained by Luke Wh Pastebins are a type of online content storage service where users can store plain text document, e.g. program source code. For more information and the history of Pastebin see Wikipedia's [article on them](https://en.wikipedia.org/wiki/Pastebin). **Features:** -- [X] 99% self-contained: only requires Postgres to run. -- [X] Raw text and file uploading -- [X] Phrase and random string identifiers. -- [X] Custom documents that are always available. -- [X] Configurable ratelimiting, expiration, compression, etc. -- [X] Modern, JavaScript-free user interface -- [X] Syntax highlighting for all the most popular languages and Raw text mode -- [ ] Password-protected encrypted pastes -- [ ] SQLite Support -- [ ] Paste collections -- [ ] Reader view mode (Markdown is formatted and word wraping is enbaled) -- [ ] QR Codes -- [ ] Image uploading -> [!TIP] -> **Try our public online version at [https://spaceb.in](https://spaceb.in)**! +- [x] 99% self-contained: only requires Postgres to run. +- [x] Raw text and file uploading +- [x] Phrase and random string identifiers. +- [x] Custom documents that are always available. +- [x] Configurable ratelimiting, expiration, compression, etc. +- [x] Modern, JavaScript-free user interface +- [x] Syntax highlighting for all the most popular languages and Raw text mode +- [ ] Password-protected encrypted pastes +- [ ] SQLite Support +- [ ] Paste collections +- [ ] Reader view mode (Markdown is formatted and word wrapping is enabled) +- [ ] QR Codes +- [ ] Image uploading + +> [!TIP] > **Try our public online version at [https://spaceb.in](https://spaceb.in)**! ## Table of Contents @@ -64,8 +64,7 @@ $ sudo docker run -d -p 80:9000 spacebinorg/spirit #### Manually -> [!IMPORTANT] -> **Requires: [Git](https://git-scm.com/downloads), [Go 1.22.4](https://go.dev/doc/install), [GNU Makefile](https://www.gnu.org/software/make/#download), and a [PostgreSQL](https://www.postgresql.org/download/) [server](https://m.do.co/c/beaf675c3e00).** +> [!IMPORTANT] > **Requires: [Git](https://git-scm.com/downloads), [Go 1.22.4](https://go.dev/doc/install), [GNU Makefile](https://www.gnu.org/software/make/#download), and a [PostgreSQL](https://www.postgresql.org/download/) [server](https://m.do.co/c/beaf675c3e00).** ```sh # Clone the Github repository @@ -83,19 +82,19 @@ $ SPIRIT_CONNECTION_URI="" ./bin/spirit #### Environment Variables -| Variable Name | Type | Default | Description | -|-------------------------|-----------------------|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------| -| `SPIRIT_HOST` | String | `0.0.0.0` | Host address to listen on | -| `SPIRIT_PORT` | Int | `9000` | HTTP port to listen on | -| `SPIRIT_RATELIMITER` | String | `200x5` | Requests allowed per second before the user is ratelimited | -| `SPIRIT_CONNECTION_URI` | String | **Required** | [PostgreSQL Database URI String](https://stackoverflow.com/questions/3582552/what-is-the-format-for-the-postgresql-connection-string-url#20722229) | -| `SPIRIT_HEADLESS` | Bool | `False` | Enables/disables the web interface | -| `SPIRIT_ANALYTICS` | String | `""` | `