From c194f4956d2e80f863cc3349719526b4ddbfcc9d Mon Sep 17 00:00:00 2001 From: Elara6331 Date: Thu, 13 Feb 2025 13:01:20 -0800 Subject: [PATCH] Create custom CI pipeline --- .goreleaser.yaml | 70 ---------------------------------------- .nfpm.yaml | 20 ++++++++++++ .woodpecker.yml | 30 ----------------- .woodpecker/build.yml | 53 ++++++++++++++++++++++++++++++ .woodpecker/manifest.yml | 19 +++++++++++ Dockerfile | 3 ++ 6 files changed, 95 insertions(+), 100 deletions(-) delete mode 100644 .goreleaser.yaml create mode 100644 .nfpm.yaml delete mode 100644 .woodpecker.yml create mode 100644 .woodpecker/build.yml create mode 100644 .woodpecker/manifest.yml create mode 100644 Dockerfile diff --git a/.goreleaser.yaml b/.goreleaser.yaml deleted file mode 100644 index eb8e073..0000000 --- a/.goreleaser.yaml +++ /dev/null @@ -1,70 +0,0 @@ -version: 2 -before: - hooks: - - go mod tidy -builds: - - id: distrohop - env: - - CGO_ENABLED=0 - binary: distrohop - goos: - - linux - goarch: - - amd64 - - '386' - - arm64 - - arm - - riscv64 -archives: - - files: - - distrohop.service -nfpms: - - id: distrohop - description: "A utility for correlating and identifying equivalent software packages across different Linux distributions" - homepage: 'https://gitea.elara.ws/Elara6331/distrohop' - maintainer: 'Elara Ivy ' - license: AGPLv3 - formats: - - deb - - rpm - - archlinux - provides: - - distrohop - conflicts: - - distrohop - contents: - - src: distrohop.service - dst: /etc/systemd/system/distrohop.service -aurs: - - name: distrohop-bin - homepage: 'https://gitea.elara.ws/Elara6331/distrohop' - description: "A utility for correlating and identifying equivalent software packages across different Linux distributions" - maintainers: - - 'Elara Ivy ' - license: AGPLv3 - private_key: '{{ .Env.AUR_KEY }}' - git_url: 'ssh://aur@aur.archlinux.org/distrohop-bin.git' - provides: - - distrohop - conflicts: - - distrohop - package: |- - # binaries - install -Dm755 ./distrohop "${pkgdir}/usr/bin/distrohop" - - # services - install -Dm644 ./distrohop.service "${pkgdir}/etc/systemd/system/distrohop.service" -release: - gitea: - owner: Elara6331 - name: distrohop -gitea_urls: - api: 'https://gitea.elara.ws/api/v1/' - download: 'https://gitea.elara.ws' - skip_tls_verify: false -checksum: - name_template: 'checksums.txt' -snapshot: - name_template: "{{ incpatch .Version }}-next" -changelog: - sort: asc \ No newline at end of file diff --git a/.nfpm.yaml b/.nfpm.yaml new file mode 100644 index 0000000..b5897fc --- /dev/null +++ b/.nfpm.yaml @@ -0,0 +1,20 @@ +name: distrohop +description: "A utility for correlating and identifying equivalent software packages across different Linux distributions" +homepage: 'https://gitea.elara.ws/Elara6331/distrohop' +maintainer: 'Elara Ivy ' +license: AGPLv3 +arch: ${ARCH} +version: ${VERSION} +provides: + - distrohop +conflicts: + - distrohop +contents: + - src: distrohop + dst: /usr/bin/distrohop + file_info: + mode: 0755 + - src: distrohop.service + dst: /etc/systemd/system/distrohop.service + file_info: + mode: 0644 \ No newline at end of file diff --git a/.woodpecker.yml b/.woodpecker.yml deleted file mode 100644 index 33e2760..0000000 --- a/.woodpecker.yml +++ /dev/null @@ -1,30 +0,0 @@ -labels: - platform: linux/amd64 - -steps: - - name: docker - image: gitea.elara.ws/elara6331/builder - commands: - - registry-login - - ko build -B --platform=linux/amd64,linux/arm64,linux/riscv64 -t latest,${CI_COMMIT_TAG} --sbom=none - environment: - REGISTRY: gitea.elara.ws - REGISTRY_USERNAME: Elara6331 - KO_DOCKER_REPO: gitea.elara.ws/elara6331 - KO_DEFAULTBASEIMAGE: gitea.elara.ws/elara6331/static-root - REGISTRY_PASSWORD: - from_secret: registry_password - when: - event: tag - - - name: release - image: goreleaser/goreleaser - commands: - - goreleaser release - environment: - GITEA_TOKEN: - from_secret: gitea_token - AUR_KEY: - from_secret: aur_key - when: - event: tag \ No newline at end of file diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml new file mode 100644 index 0000000..4f14f64 --- /dev/null +++ b/.woodpecker/build.yml @@ -0,0 +1,53 @@ +matrix: + platform: + - linux/amd64 + - linux/arm64 + +labels: + platform: ${platform} + +steps: + - name: build + image: golang:1.23.6 + commands: + - go build + when: + - event: tag + + - name: docker + image: woodpeckerci/plugin-kaniko + settings: + registry: gitea.elara.ws + repo: elara6331/distrohop + tags: ${platform##linux/} + cache: true + username: elara6331 + password: + from_secret: gitea_token + when: + event: tag + + - name: nfpm + image: goreleaser/nfpm + environment: + ARCH: ${platform##linux/} + VERSION: ${CI_COMMIT_TAG##v} + commands: + - nfpm pkg -f .nfpm.yaml -p deb -t . + - nfpm pkg -f .nfpm.yaml -p rpm -t . + - nfpm pkg -f .nfpm.yaml -p archlinux -t . + when: + event: tag + + - name: release + image: gitea.elara.ws/elara6331/woodpecker-release + settings: + title: "Version ${CI_COMMIT_TAG##v}" + files: + - '*.deb' + - '*.rpm' + - '*.tar.zst' + api_key: + from_secret: gitea_token + when: + event: tag \ No newline at end of file diff --git a/.woodpecker/manifest.yml b/.woodpecker/manifest.yml new file mode 100644 index 0000000..e6c5e24 --- /dev/null +++ b/.woodpecker/manifest.yml @@ -0,0 +1,19 @@ +labels: + platform: linux/amd64 + +steps: + - name: manifest + image: gcr.io/go-containerregistry/crane:debug + entrypoint: ["/busybox/sh", "-c", "echo $CI_SCRIPT | base64 -d | /busybox/sh -e"] + commands: + - crane auth login -u elara6331 -p $REGISTRY_TOKEN gitea.elara.ws + - crane index append -m gitea.elara.ws/elara6331/distrohop:amd64 -m gitea.elara.ws/elara6331/distrohop:arm64 -t gitea.elara.ws/elara6331/distrohop:latest + - crane index append -m gitea.elara.ws/elara6331/distrohop:amd64 -m gitea.elara.ws/elara6331/distrohop:arm64 -t gitea.elara.ws/elara6331/distrohop:${CI_COMMIT_TAG} + environment: + REGISTRY_TOKEN: + from_secret: gitea_token + when: + - event: tag + +depends_on: + - build \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1b5063c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM gitea.elara.ws/elara6331/static-root:latest +COPY distrohop /bin/distrohop +ENTRYPOINT [ "/bin/distrohop" ] \ No newline at end of file