diff --git a/.drone.yml b/.drone.yml index eea4dbd..cc2b5d8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,14 +1,30 @@ +--- +kind: pipeline +type: docker +name: cleanup-before + +steps: + - name: clean + image: alpine + commands: + - rm -rf /build/* + volumes: + - name: build + path: /build + when: + event: tag + +volumes: + - name: build + host: + path: /tmp/qrz/build + --- kind: pipeline type: docker name: default-linux-amd64 steps: - - name: packr2 - image: golang - commands: - - go get -u github.com/gobuffalo/packr/v2/packr2 - - go build -o packr2 -mod=mod github.com/gobuffalo/packr/v2/packr2 - name: build image: golang commands: @@ -16,37 +32,33 @@ steps: environment: GOOS: linux GOARCH: amd64 - - name: release - image: plugins/gitea-release - settings: - base_url: https://git.paulbsd.com - api_key: - from_secret: gitea_token - files: "*.tar.gz" - checksum: - - sha256 - - sha512 - when: - event: tag + volumes: + - name: build + path: /build + +volumes: + - name: build + host: + path: /tmp/qrz/build + +depends_on: + - cleanup-before --- kind: pipeline type: docker -name: default-linux-arm64 +name: gitea-release steps: - - name: packr2 - image: golang + - name: move + image: alpine commands: - - go get -u github.com/gobuffalo/packr/v2/packr2 - - go build -o packr2 -mod=mod github.com/gobuffalo/packr/v2/packr2 - - name: build - image: golang - commands: - - ./ci-build.sh build - environment: - GOOS: linux - GOARCH: arm64 + - mv build/* ./ + volumes: + - name: build + path: /drone/src/build + when: + event: tag - name: release image: plugins/gitea-release settings: @@ -57,5 +69,50 @@ steps: checksum: - sha256 - sha512 + title: VERSION + volumes: + - name: build + path: /drone/src/build when: event: tag + - name: ls + image: alpine + commands: + - find . + volumes: + - name: build + path: /drone/src/build + when: + event: tag + +volumes: + - name: build + host: + path: /tmp/qrz/build + +depends_on: + - default-linux-amd64 + +--- +kind: pipeline +type: docker +name: cleanup-after + +steps: + - name: clean + image: alpine + commands: + - rm -rf /build/* + volumes: + - name: build + path: /build + when: + event: tag + +volumes: + - name: build + host: + path: /tmp/qrz/build + +depends_on: + - gitea-release diff --git a/ci-build.sh b/ci-build.sh index ca32683..cd60129 100755 --- a/ci-build.sh +++ b/ci-build.sh @@ -10,38 +10,42 @@ GOOPTIONS="-mod=vendor" SRCFILES=cmd/qrz/*.go build() { + echo "Begin of build" if [[ ! -z $DRONE_TAG ]] then + echo "Drone tag set, let's do a release" VERSION=$DRONE_TAG + echo "${PROJECTNAME} ${VERSION}" > /build/VERSION elif [[ ! -z $DRONE_TAG ]] then + echo "Drone not set, let's only do a build" VERSION=$DRONE_COMMIT fi if [[ ! -z $VERSION && ! -z $GOOS && ! -z $GOARCH ]] then + echo "Let's set a release name" RELEASENAME=${PROJECTNAME}-${VERSION}-${GOOS}-${GOARCH} fi - echo "Running packr2" - if [[ -f ./packr2 ]] - then - ./packr2 - else - echo "packr2 binary not found" - exit 1 - fi + echo "Getting packr2 and building embedded files" + go get -u github.com/gobuffalo/packr/v2/packr2 + packr2 echo "Building project" go build -o ${PROJECTNAME} ${GOOPTIONS} ${SRCFILES} if [[ ! -z $DRONE_TAG ]] then - tar -czvf ${RELEASENAME}.tar.gz ${PROJECTNAME} + echo "Let's make archives" + mkdir -p /build + tar -czvf /build/${RELEASENAME}.tar.gz ${PROJECTNAME} fi echo "Removing binary file" rm ${PROJECTNAME} + + echo "End of build" } clean() { @@ -56,5 +60,7 @@ case $1 in clean ;; *) + echo "No options choosen" + exit 1 ;; esac diff --git a/go.mod b/go.mod index 1da38ac..d6680de 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,7 @@ require ( golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect golang.org/x/text v0.3.4 // indirect - golang.org/x/tools v0.0.0-20201118215654-4d9c4f8a78b0 // indirect + golang.org/x/tools v0.0.0-20201204222352-654352759326 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.25.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect diff --git a/go.sum b/go.sum index 15b20a1..36daf6d 100644 --- a/go.sum +++ b/go.sum @@ -544,6 +544,8 @@ golang.org/x/tools v0.0.0-20200308013534-11ec41452d41 h1:9Di9iYgOt9ThCipBxChBVhg golang.org/x/tools v0.0.0-20200308013534-11ec41452d41/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20201118215654-4d9c4f8a78b0 h1:ZE8TbQqVy3d5tnnRBBhbtisccQkE4JMRX0YdHumcbNc= golang.org/x/tools v0.0.0-20201118215654-4d9c4f8a78b0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201204222352-654352759326 h1:XKLw9EEEfGJFE2K5Ni4nXgtFBIfI+zKPIi2SlRYmIG4= +golang.org/x/tools v0.0.0-20201204222352-654352759326/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/src/config/main.go b/src/config/main.go index fbeedfc..d052a22 100644 --- a/src/config/main.go +++ b/src/config/main.go @@ -41,7 +41,46 @@ func (config *Config) GetConfig() error { config.URLBase = `http://groupe-frs.hamstation.eu/index_qrz_liste_%s.php` - config.QrzGroups = []string{"01", "03", "09", "103", "104", "107", "119", "13", "146", "147", "15", "156", "16", "161", "163", "18", "188", "2", "214", "233", "25", "26", "29", "30", "31", "32", "34", "43", "44", "49", "54", "64", "66", "76", "79", "84", "97", "98"} + config.QrzGroups = []string{ + "01", + "03", + "09", + "103", + "104", + "107", + "119", + "13", + "14", + "146", + "147", + "15", + "156", + "16", + "161", + "163", + "18", + "188", + "2", + "214", + "233", + "25", + "26", + "29", + "30", + "31", + "32", + "34", + "43", + "44", + "49", + "54", + "64", + "66", + "76", + "79", + "84", + "97", + "98"} return nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 2ff5cc6..044c6f8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -160,7 +160,7 @@ golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm -# golang.org/x/tools v0.0.0-20201118215654-4d9c4f8a78b0 +# golang.org/x/tools v0.0.0-20201204222352-654352759326 ## explicit # google.golang.org/appengine v1.6.7 ## explicit