瀏覽代碼

build: standardize release urls and scripts

Ask Bjørn Hansen 2 年之前
父節點
當前提交
1670c53c72
共有 3 個文件被更改,包括 12 次插入10 次删除
  1. 5 4
      .drone.yml
  2. 6 5
      scripts/download-release
  3. 1 1
      scripts/run-goreleaser

+ 5 - 4
.drone.yml

@@ -55,6 +55,7 @@ steps:
       - name: gopkg
         path: /cache
     commands:
+      - go install github.com/goreleaser/[email protected]
       - ./scripts/run-goreleaser
       - echo Done
     when:
@@ -79,7 +80,7 @@ steps:
       secret_key:
         from_secret: s3_secret_key
       bucket: geodns
-      target: /builds/test/${DRONE_BUILD_NUMBER}
+      target: /geodns/builds/test/${DRONE_BUILD_NUMBER}
       source: dist/*
       strip_prefix: dist/
       endpoint: https://minio-ewr1.develooper.com/
@@ -129,7 +130,7 @@ steps:
   - name: download
     image: golang:1.20.5
     commands:
-      - ./scripts/download-release test/${DRONE_BUILD_PARENT} dist/
+      - ./scripts/download-release geodns test/${DRONE_BUILD_PARENT} dist/
     resources:
       requests:
         cpu: 250
@@ -153,7 +154,7 @@ steps:
       secret_key:
         from_secret: s3_secret_key
       bucket: geodns
-      target: /builds/release/${DRONE_BUILD_NUMBER}
+      target: /geodns/builds/release/${DRONE_BUILD_NUMBER}
       source: dist/*
       strip_prefix: dist/
       endpoint: https://minio-ewr1.develooper.com/
@@ -183,6 +184,6 @@ trigger:
     - publish
 ---
 kind: signature
-hmac: 3cefa2d3e35450fc898c0565bb977765f738ee4cf7a433cf7e5b2b6e3e7c31b1
+hmac: ca3996a809efaa311bfdc783ed6453abdbd2bcd996947bf483ac0e9bbba512a1
 
 ...

+ 6 - 5
scripts/download-release

@@ -1,20 +1,21 @@
 #!/bin/bash
 
-BUILD=$1
-DIR=$2
+BASE=$1
+BUILD=$2
+DIR=$3
 
 set -euo pipefail
 
 if [ -z "$DIR" ]; then
-  echo run with $0 BUILD_NUMBER DIR
+  echo run with $0 NAME BUILD_NUMBER DIR
   exit 2
 fi
 
 mkdir -p $DIR
 
-BASE=https://geodns.bitnames.com/builds/$BUILD
+BASE=https://geodns.bitnames.com/${BASE}/builds/${BUILD}
 
-files=`curl -sf $BASE/checksums.txt | awk '{print $2}'`
+files=`curl -sSf ${BASE}/checksums.txt | awk '{print $2}'`
 metafiles="checksums.txt metadata.json CHANGELOG.md artifacts.json"
 
 for f in $metafiles; do

+ 1 - 1
scripts/run-goreleaser

@@ -10,4 +10,4 @@ if [ -z "$DRONE_TAG" ]; then
   is_snapshot="--snapshot"
 fi
 
-curl -fsL https://git.io/goreleaser | bash -s -- release --snapshot -p 3
+goreleaser release $is_snapshot -p 6 --skip-publish