diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..8495a9d --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,41 @@ +stages: + - build + - release + +build: + image: golang + stage: build + script: + - echo "Build Commit $CI_COMMIT_SHA" + - cd cmd + - GOOS=linux GOARCH=amd64 go build -o telegraf-clickhouse-plugin-linux-amd64 + - GOOS=linux GOARCH=arm64 go build -o telegraf-clickhouse-plugin-linux-arm64 + after_script: + - echo "JOB_ID=$CI_JOB_ID" >> job.env + artifacts: + paths: + - telegraf-clickhouse-plugin-linux-amd64 + - telegraf-clickhouse-plugin-linux-arm64 + expire_in: 1d + reports: + dotenv: job.env + +release: + image: registry.gitlab.com/gitlab-org/release-cli + stage: release + needs: + - job: build + artifacts: true + script: + - echo "Create Release $CI_COMMIT_SHA" + release: + name: "Release $CI_COMMIT_SHORT_SHA" + tag_name: "$CI_COMMIT_SHORT_SHA" + ref: "$CI_COMMIT_SHORT_SHA" + description: "Release $CI_COMMIT_SHORT_SHA" + assets: + links: + - name: "telegraf-clickhouse-plugin-linux-amd64" + url: "https://git.karaolidis.com/karaolidis/liebling/-/jobs/$JOB_ID/artifacts/raw/telegraf-clickhouse-plugin-linux-amd64" + - name: "telegraf-clickhouse-plugin-linux-arm64" + url: "https://git.karaolidis.com/karaolidis/liebling/-/jobs/$JOB_ID/artifacts/raw/telegraf-clickhouse-plugin-linux-arm64"