From 66b2f83a88e3bd240231a9221d8575e041ca8559 Mon Sep 17 00:00:00 2001 From: Timur Demin Date: Sun, 1 Aug 2021 03:47:15 +0500 Subject: [PATCH] Migrate to GitHub --- .drone.yml | 44 -------------------------------- .github/workflows/docker.yml | 30 ++++++++++++++++++++++ .github/workflows/goreleaser.yml | 25 ++++++++++++++++++ .github/workflows/tests.yml | 21 +++++++++++++++ .goreleaser.yml | 5 +--- README.md | 2 +- cmd/gmnhg/main.go | 2 +- cmd/md2gmn/main.go | 2 +- go.mod | 2 +- render.go | 2 +- 10 files changed, 82 insertions(+), 53 deletions(-) delete mode 100644 .drone.yml create mode 100644 .github/workflows/docker.yml create mode 100644 .github/workflows/goreleaser.yml create mode 100644 .github/workflows/tests.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index c503871..0000000 --- a/.drone.yml +++ /dev/null @@ -1,44 +0,0 @@ -kind: pipeline -name: build & release - -steps: -- name: fetch tags - image: docker:git - commands: - - git fetch --tags - when: - event: tag -- name: test - image: golang:1.14 - commands: - - go test -v ./internal/gemini - when: - event: - exclude: - - tag -- name: release - image: golang:1.15 - environment: - GITEA_TOKEN: - from_secret: goreleaser_gitea_token - commands: - - curl -sL https://git.io/goreleaser | bash - when: - event: tag -- name: build docker image - image: plugins/docker - settings: - username: - from_secret: username - password: - from_secret: password - repo: registry.git.tdem.in/gmnhg - registry: registry.git.tdem.in - dockerfile: Dockerfile - tags: - - ${DRONE_TAG} - - latest - when: - event: - - tag - diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..ac376e2 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,30 @@ +name: Push to GHCR + +on: + release: + types: + - created + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GHCR_TOKEN }} + - name: Build & push + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/tdemin/gmnhg:latest + ghcr.io/tdemin/gmnhg:${{ github.event.release.tag_name }} diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 0000000..0559486 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,25 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Run goreleaser + uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..46c48b5 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,21 @@ +name: Run tests + +on: + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Run tests + run: go test -v ./... + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.41.1 diff --git a/.goreleaser.yml b/.goreleaser.yml index 9a9370d..5dbd2ee 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -45,9 +45,6 @@ changelog: - '^test:' release: - gitea: + github: owner: tdemin name: gmnhg - -gitea_urls: - api: https://git.tdem.in/api/v1/ diff --git a/README.md b/README.md index cba9b90..102feb3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Hugo-to-Gemini converter -[![PkgGoDev](https://pkg.go.dev/badge/git.tdem.in/tdemin/gmnhg)](https://pkg.go.dev/git.tdem.in/tdemin/gmnhg) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/tdemin/gmnhg)](https://pkg.go.dev/github.com/tdemin/gmnhg) This repo holds a converter of Hugo Markdown posts to [text/gemini][Gemtext] (also named Gemtext in this README). The diff --git a/cmd/gmnhg/main.go b/cmd/gmnhg/main.go index a283e7e..98f1ee7 100644 --- a/cmd/gmnhg/main.go +++ b/cmd/gmnhg/main.go @@ -76,7 +76,7 @@ import ( "strings" "text/template" - gemini "git.tdem.in/tdemin/gmnhg" + gemini "github.com/tdemin/gmnhg" ) const ( diff --git a/cmd/md2gmn/main.go b/cmd/md2gmn/main.go index e13282f..5760bd5 100644 --- a/cmd/md2gmn/main.go +++ b/cmd/md2gmn/main.go @@ -22,7 +22,7 @@ import ( "io/ioutil" "os" - gemini "git.tdem.in/tdemin/gmnhg" + gemini "github.com/tdemin/gmnhg" ) var version = "v0+HEAD" diff --git a/go.mod b/go.mod index 19fa428..69ade2c 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module git.tdem.in/tdemin/gmnhg +module github.com/tdemin/gmnhg go 1.15 diff --git a/render.go b/render.go index 4a8701f..a608e8c 100644 --- a/render.go +++ b/render.go @@ -23,9 +23,9 @@ import ( "fmt" "time" - "git.tdem.in/tdemin/gmnhg/internal/gemini" "github.com/gomarkdown/markdown" "github.com/gomarkdown/markdown/parser" + "github.com/tdemin/gmnhg/internal/gemini" "gopkg.in/yaml.v2" )