diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml new file mode 100644 index 0000000..ddac8ec --- /dev/null +++ b/.github/workflows/docker-publish.yaml @@ -0,0 +1,92 @@ +name: Docker publish + +on: + release: + types: + - created + workflow_dispatch: + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21' + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v ./... + + + build: + needs: test + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=tag + # Determine the release version + + - name: Get release version + id: get-release-version + run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//} + if: startsWith(github.ref, 'refs/tags/') + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v4 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: | + ${{ steps.meta.outputs.tags }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get-release-version.outputs.version }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 925866c..35a6c0a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -4,8 +4,8 @@ name: Go on: - push: - branches: [ "main" ] + #push: + # branches: [ "main" ] pull_request: branches: [ "main" ] @@ -19,7 +19,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: '1.21' - name: Build run: go build -v ./... diff --git a/README.md b/README.md index 6e72bae..d444f87 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,30 @@ These features are not in the latest release but in the main branch. They might ## Setup +
+ + + +### Manual building + + - `git clone https://github.com/acheong08/obsidian-sync` - `cd obsidian-sync` - `export HOST=` - Not necessary when running on localhost - `go run cmd/obsidian-sync/main.go` -- Use nginx or cloudflare to proxy & handle TLS/SSL -~~**HTTPS _should_ be required. I use `certbot` or Cloudflare**. By default, the sync uses `wss` unless you're operating on `localhost` or `127.0.0.1` which breaks if you don't have TLS/SSL~~ +
+ +
+ + + +### Docker + + +https://github.com/acheong08/rev-obsidian-sync/pkgs/container/rev-obsidian-sync + +
HTTPS is not required. @@ -79,6 +96,8 @@ server { } ``` +You can use `certbot` or cloudflare to handle HTTPS although it is not mandatory. + ## Adding a new user @@ -103,9 +122,3 @@ This plugin will not be part of the official community plugins list. - Set API endpoint - e.g. `https://obsidian.yourdomain.com` - For development: `http://127.0.0.1:3000` - -Known bugs: - -- ~~Cannot restart plugin (for whatever reason you might want to do that...) - Restart the app if you want to reload this particular plugin~~ - -Report all bugs in this repository.