|
| 1 | +pipeline: |
| 2 | + name: drone-plugin-harness |
| 3 | + identifier: dronepluginharness |
| 4 | + projectIdentifier: Drone_Plugins |
| 5 | + orgIdentifier: default |
| 6 | + tags: {} |
| 7 | + properties: |
| 8 | + ci: |
| 9 | + codebase: |
| 10 | + connectorRef: GitHub_Drone_Org |
| 11 | + repoName: plugin |
| 12 | + build: <+input> |
| 13 | + stages: |
| 14 | + - stage: |
| 15 | + name: Build and Binaries Release |
| 16 | + identifier: Build_and_Binaries_Release |
| 17 | + description: "" |
| 18 | + type: CI |
| 19 | + spec: |
| 20 | + cloneCodebase: true |
| 21 | + caching: |
| 22 | + enabled: true |
| 23 | + platform: |
| 24 | + os: Linux |
| 25 | + arch: Amd64 |
| 26 | + runtime: |
| 27 | + type: Cloud |
| 28 | + spec: {} |
| 29 | + execution: |
| 30 | + steps: |
| 31 | + - step: |
| 32 | + type: Run |
| 33 | + name: version |
| 34 | + identifier: version |
| 35 | + spec: |
| 36 | + shell: Sh |
| 37 | + command: VERSION=${DRONE_TAG} |
| 38 | + outputVariables: |
| 39 | + - name: VERSION |
| 40 | + type: String |
| 41 | + value: VERSION |
| 42 | + when: |
| 43 | + stageStatus: Success |
| 44 | + condition: <+codebase.build.type> == "tag" |
| 45 | + - step: |
| 46 | + type: Run |
| 47 | + name: Test and Build |
| 48 | + identifier: Test_and_Build |
| 49 | + spec: |
| 50 | + connectorRef: Plugins_Docker_Hub_Connector |
| 51 | + image: golang:1.19 |
| 52 | + shell: Sh |
| 53 | + command: |- |
| 54 | + go test ./... |
| 55 | + GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o release/plugin-linux-amd64 |
| 56 | + GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -o release/plugin-linux-arm64 |
| 57 | + GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -o release/plugin-darwin-amd64 |
| 58 | + GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w" -o release/plugin-darwin-arm64 |
| 59 | + GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o release/plugin-windows-amd64.exe |
| 60 | + - step: |
| 61 | + type: Plugin |
| 62 | + name: Release amd64 Binaries |
| 63 | + identifier: Release_amd64_Binaries |
| 64 | + spec: |
| 65 | + connectorRef: Plugins_Docker_Hub_Connector |
| 66 | + image: plugins/github-release |
| 67 | + settings: |
| 68 | + api_key: <+secrets.getValue("ci_job_github_pat")> |
| 69 | + title: <+trigger.tag> |
| 70 | + files: |
| 71 | + - release/plugin-linux-amd64 |
| 72 | + - release/plugin-linux-arm64 |
| 73 | + - release/plugin-darwin-amd64 |
| 74 | + - release/plugin-darwin-arm64 |
| 75 | + - release/plugin-windows-amd64.exe |
| 76 | + when: |
| 77 | + stageStatus: Success |
| 78 | + condition: <+codebase.build.type> == "tag" |
| 79 | + - step: |
| 80 | + name: Upload_Binaries_To_GCS |
| 81 | + identifier: Upload_Binaries_To_GCS |
| 82 | + template: |
| 83 | + templateRef: Upload_Binary_GCS_TI |
| 84 | + versionLabel: v1 |
| 85 | + templateInputs: |
| 86 | + type: GCSUpload |
| 87 | + spec: |
| 88 | + sourcePath: /harness/release |
| 89 | + target: harness-plugin/<+pipeline.stages.Build_and_Binaries_Release.spec.execution.steps.version.output.outputVariables.VERSION> |
| 90 | + when: |
| 91 | + condition: <+codebase.build.type> == "tag" |
| 92 | + allowStageExecutions: true |
0 commit comments