sinlov/woodpecker-gitea-publisher-golang

By sinlov

Updated over 1 year ago

plugin woodpecker for https://docs.gitea.com/usage/packages/go/ to publisher golang package

Image
0

10K+

sinlov/woodpecker-gitea-publisher-golang repository overview

woodpecker-gitea-publisher-golang

plugin as https://woodpecker-ci.org/ for https://docs.gitea.com/usage/packages/go/ to publisher golang package

Features

  • push to gitea Go Package Registry
  • use TempDir to generate go mod zip file
  • support dry-run mode
  • auto get gitea base URL by CI_FORGE_URL
  • support Monorepo
    • use settings.gitea-publish-golang-path-go to publish dir go.mod one by one
  • out publish info json file default dist/go-mod-upload.json
    • use settings.gitea-publish-golang-update-result-root-path to change out root path, default dist
    • use settings.gitea-publish-golang-update-result-file-name to change out file name, default go-mod-upload.json

Settings

NameRequiredDefault valueDescription
debugnofalseopen debug log or open by env PLUGIN_DEBUG
gitea-publish-golang-api-keyyesgitea api key, Required
gitea-publish-golang-base-urlnogitea base url, default by CI_FORGE_URL
gitea-publish-golang-insecurenofalsegitea insecure enable
gitea-publish-golang-dry-runnofalsedry run mode
gitea-publish-golang-path-gonopublish go package is dir to find go.mod, will append project root path, default is this project root path
gitea-publish-golang-remove-pathsno["dist"]publish go package remove paths, this path under gitea-publish-golang-path-go, default will remove dist
gitea-publish-golang-update-result-root-pathnodistout result root path append CI Workspace, default dist
gitea-publish-golang-update-result-file-namenogo-mod-upload.jsonout file name, default go-mod-upload.json

Hide Settings:

NameRequiredDefault valueDescription
timeout_secondno10command timeout setting by second
gitea-publish-golang-timeout-secondno60gitea release api timeout second, default 60, less 30
woodpecker-kit-steps-transfer-file-pathno.woodpecker_kit.steps.transferSteps transfer file path, default by wd_steps_transfer.DefaultKitStepsFileName
woodpecker-kit-steps-transfer-disable-outnofalseSteps transfer write disable out

Example

  • workflow with backend docker

docker hub version semver docker hub image size docker hub image pulls

labels:
  backend: docker
steps:
  woodpecker-gitea-publisher-golang:
    image: sinlov/woodpecker-gitea-publisher-golang:latest
    pull: false
    settings:
      # debug: true
      # gitea-publish-golang-dry-run: true # dry run mode
      gitea-publish-golang-api-key: # gitea api key, Required
        from_secret: gitea_api_key_release
      gitea-publish-golang-path-go: "" # publish go package is dir to find go.mod, will append project root path, default is this project root path
      gitea-publish-golang-remove-paths: # publish go package remove paths, this path under `gitea-publish-golang-path-go`, default will remove `dist`
        - "dist"
      # gitea-publish-golang-update-result-root-path: "dist" # out result root path append CI Workspace, default `dist`
      # gitea-publish-golang-update-result-file-name: "go-mod-upload.json" # out file name, default `go-mod-upload.json`
  • workflow with backend local, must install at local and effective at evn PATH
  • install at ${GOPATH}/bin, latest
go install -a github.com/woodpecker-kit/woodpecker-gitea-publisher-golang/cmd/woodpecker-gitea-publisher-golang@latest

GitHub latest SemVer tag) GitHub release)

  • install at ${GOPATH}/bin, v1.0.0
go install -v github.com/woodpecker-kit/woodpecker-gitea-publisher-golang/cmd/[email protected]
labels:
  backend: local
steps:
  woodpecker-gitea-publisher-golang:
    image: woodpecker-gitea-publisher-golang
    settings:
      # debug: true
      # gitea-publish-golang-dry-run: true # dry run mode
      gitea-publish-golang-api-key: # gitea api key, Required
        from_secret: gitea_api_key_release
      gitea-publish-golang-path-go: "" # publish go package is dir to find go.mod, will append project root path, default is this project root path
      gitea-publish-golang-remove-paths: # publish go package remove paths, this path under `gitea-publish-golang-path-go`, default will remove `dist`
        - "dist"
      # gitea-publish-golang-update-result-root-path: "dist" # out result root path append CI Workspace, default `dist`
      # gitea-publish-golang-update-result-file-name: "go-mod-upload.json" # out file name, default `go-mod-upload.json`
  • full config
labels:
  backend: docker
steps:
  woodpecker-gitea-publisher-golang:
    image: sinlov/woodpecker-gitea-publisher-golang:latest
    pull: false
    settings:
      debug: true
      gitea-publish-golang-dry-run: true # dry run mode
      gitea-publish-golang-timeout-second: 120 # gitea release api timeout second, default 60, less 30 
      gitea-publish-golang-api-key: # gitea api key, Required
        from_secret: gitea_api_key_release
      gitea-publish-golang-base-url: "https://gitea.example.com" # default by CI_FORGE_URL auto to find
      gitea-publish-golang-insecure: true #  gitea insecure enable
      gitea-publish-golang-path-go: "sub-go" # publish go package is dir to find go.mod, will append project root path, default is this project root path
      gitea-publish-golang-remove-paths: # publish go package remove paths, this path under `gitea-publish-golang-path-go`, default will remove `dist`
        - "dist"
      gitea-publish-golang-update-result-root-path: "dist" # out result root path append CI Workspace, default `dist`
      gitea-publish-golang-update-result-file-name: "go-mod-upload.json" # out file name, default `go-mod-upload.json`

Notes

  • go mod zip file will generate by TempDir and try to remove after publish
  • template dir path graph tempDir/woodpecker-gitea-publisher-golang/{repo-hostname}/{owner}/{repo}/{build_number}

Known limitations

  1. go mod zip file generate by zip.CreateFromDir, this method will check as https://semver.org/, so this kit use CI_COMMIT_TAG to generate version
  2. open gitea-publish-golang-dry-run mode can pass all check, but not publish to gitea
  3. but without event tag will use version mark as latest, this will not pass zip.CreateFromDircheck, so will not publish to gitea

Tag summary

Content type

Image

Digest

sha256:26a764163

Size

6.5 MB

Last updated

over 1 year ago

docker pull sinlov/woodpecker-gitea-publisher-golang