diff --git a/.circleci/config.yml b/.circleci/config.yml index e741da9f..ff57122a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ jobs: test: docker: - image: circleci/golang:1.13 - working_directory: /go/src/github.com/segmentio/aws-okta + working_directory: /go/src/github.com/optimizely/aws-okta steps: - run: # Do this prior to checkout so that it doesn't modify go.mod file. @@ -50,11 +50,10 @@ jobs: git status exit 1 fi - dist-linux: docker: - image: circleci/golang:1.13 - working_directory: /go/src/github.com/segmentio/aws-okta + working_directory: /go/src/github.com/optimizely/aws-okta steps: - checkout - run: @@ -70,11 +69,25 @@ jobs: name: Make distributables command: | make -f Makefile.release dist-linux - - persist_to_workspace: - root: . - paths: ['dist/*'] - publish-packagecloud: + docker: + - image: circleci/golang:1.13 + working_directory: /go/src/github.com/segmentio/aws-okta + steps: + - checkout + - attach_workspace: { at: . } + - run: + name: Install tools + command: | + make -f Makefile.tools github-release + # this is all for package_cloud :/ + sudo apt update -q + sudo apt install -yq ruby ruby-dev build-essential + # fixes https://askubuntu.com/questions/872399/error-failed-to-build-gem-native-extension-when-trying-to-download-rubocop + sudo gem install rake + sudo make -f Makefile.tools package_cloud + make -f Makefile.release publish-packagecloud + publish-github-linux: docker: - image: circleci/golang:1.13 working_directory: /go/src/github.com/segmentio/aws-okta @@ -85,61 +98,77 @@ jobs: name: Install tools command: | make -f Makefile.tools github-release - # this is all for package_cloud :/ - sudo apt update -q - sudo apt install -yq ruby ruby-dev build-essential - # fixes https://askubuntu.com/questions/872399/error-failed-to-build-gem-native-extension-when-trying-to-download-rubocop - sudo gem install rake - sudo make -f Makefile.tools package_cloud - make -f Makefile.release publish-packagecloud + make -f Makefile.release publish-github-linux + # ishih-opti - my changes, add job list: dist-darwin and publish-github + dist-darwin: + macos: + xcode: 12.5.1 # indicate our selected version of Xcode + steps: + - checkout + - run: + name: install packages + command: | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" + brew install go@1.17 + export PATH=/usr/local/opt/go@1.17/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/bin:$PATH + curl -Ls https://github.com/goreleaser/nfpm/releases/download/v1.2.0/nfpm_1.2.0_Darwin_x86_64.tar.gz > nfpm.tar.gz + tar xzvf nfpm.tar.gz && mv nfpm /usr/local/bin + - run: + name: make tools for macos + command: | + export PATH=/usr/local/opt/go@1.17/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/bin:$PATH + # make -f Makefile.tools rpmbuild-darwin sha256sum-darwin + make -f Makefile.tools sha256sum-darwin - publish-github-linux: + - run: + name: make distribution + command: | + export PATH=/usr/local/opt/go@1.17/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/bin:$PATH + make -f Makefile.release dist-darwin + - persist_to_workspace: + root: . + paths: ['dist/*'] + publish-github: docker: - image: circleci/golang:1.13 - working_directory: /go/src/github.com/segmentio/aws-okta + working_directory: /go/src/github.com/optimizely/aws-okta steps: - checkout - attach_workspace: { at: . } - run: - name: Install tools + name: Install tool and publish release command: | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" + export PATH=/home/linuxbrew/.linuxbrew/bin:/usr/local/opt/go@1.17/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/bin:$PATH make -f Makefile.tools github-release make -f Makefile.release publish-github-linux + make -f Makefile.release publish-github-darwin workflows: version: 2 # currently we only build/publish for linux: macOS builds require non-FOSS # Keychain libs that require a macOS host to build on - # https://github.com/segmentio/aws-okta/issues/81 - test-dist-publish-linux: + # https://github.com/optimizely/aws-okta/issues/81 + dist-publish: jobs: - - test - - test-build-golang-prev + # - test + # - test-build-golang-prev - dist-linux: # needed to ensure dist happens on tag events filters: tags: only: /.*/ - - publish-packagecloud: - context: packagecloud - requires: - - dist-linux + - dist-darwin: + # needed to ensure dist happens on tag events filters: - # never publish from a branch event - branches: - ignore: /.*/ - # release only on tag push events like vX[.Y.Z...][-whatever] tags: - only: /v[0-9]+(\.[0-9]+)*(-[a-zA-Z0-9-]+)?/ - - publish-github-linux: - context: github-segmentcircle-oss-release + only: /.*/ + ### ishih-opti - add for releasing it on github + - publish-github: + context: github-optimizelycircle-oss-release requires: - dist-linux + - dist-darwin filters: - # never publish from a branch event - branches: - ignore: /.*/ - # disabled (temporarily?) due to https://github.com/segmentio/aws-okta/issues/301 - # release only on tag push events like vX[.Y.Z...][-whatever] - # tags: - # only: /v[0-9]+(\.[0-9]+)*(-[a-zA-Z0-9-]+)?/ + tags: + only: /.*/ \ No newline at end of file diff --git a/Makefile b/Makefile index 078e38ca..c92827c0 100644 --- a/Makefile +++ b/Makefile @@ -4,13 +4,13 @@ # # This makefile is meant for humans -VERSION := $(shell git describe --tags --always --dirty="-dev") +VERSION := $(shell git describe --tags --always --dirty="-dev"|cut -d"-" -f 1) LDFLAGS := -ldflags='-X "main.Version=$(VERSION)"' test: GO111MODULE=on go test -mod=vendor -v ./... -all: dist/aws-okta-$(VERSION)-darwin-amd64 dist/aws-okta-$(VERSION)-linux-amd64 +all: dist/aws-okta-$(VERSION)-darwin-amd64 dist/aws-okta-$(VERSION)-darwin-arm64 dist/aws-okta-$(VERSION)-linux-amd64 clean: rm -rf ./dist @@ -21,6 +21,9 @@ dist/: dist/aws-okta-$(VERSION)-darwin-amd64: | dist/ GOOS=darwin GOARCH=amd64 GO111MODULE=on go build -mod=vendor $(LDFLAGS) -o $@ +dist/aws-okta-$(VERSION)-darwin-arm64: | dist/ + GOOS=darwin GOARCH=arm64 GO111MODULE=on go build -mod=vendor $(LDFLAGS) -o $@ + dist/aws-okta-$(VERSION)-linux-amd64: | dist/ GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod=vendor $(LDFLAGS) -o $@ diff --git a/Makefile.release b/Makefile.release index ad982111..ab547a29 100644 --- a/Makefile.release +++ b/Makefile.release @@ -7,7 +7,6 @@ include Makefile # use bash so we can use set -o pipefail SHELL := /bin/bash - # set --pre-release if not tagged or tree is dirty or there's a `-` in the tag ifneq (,$(findstring -,$(VERSION))) GITHUB_RELEASE_FLAGS := "--pre-release" @@ -39,7 +38,7 @@ publish-linux: publish-github-linux publish-packagecloud publish-github: publish-github-darwin publish-github-linux publish-github-sha256sums -publish-github-darwin: publish-github-darwin-bin +publish-github-darwin: publish-github-darwin-bin publish-github-darwin-bin-arm64 publish-github-linux: publish-github-linux-bin publish-github-deb publish-github-rpm @@ -47,34 +46,41 @@ publish-packagecloud: publish-packagecloud-deb publish-packagecloud-rpm github-release: set -o pipefail; \ - scripts/changelog | github-release release \ - --security-token $$GH_LOGIN \ - --user segmentio \ + scripts/changelog| github-release release \ + --user optimizely \ --repo aws-okta \ $(GITHUB_RELEASE_FLAGS) \ --tag $(VERSION) \ --description - \ - --name $(VERSION) || \ - github-release info \ - --security-token $$GH_LOGIN \ - --user segmentio \ - --repo aws-okta \ - --tag $(VERSION) + --name $(VERSION) \ + ; sleep 20 || \ + github-release info \ + --user optimizely \ + --repo aws-okta \ + --tag $(VERSION) \ + --name $(VERSION) publish-github-darwin-bin: dist/aws-okta-$(VERSION)-darwin-amd64 | github-release github-release upload \ - --security-token $$GH_LOGIN \ - --user segmentio \ + --user optimizely \ --repo aws-okta \ --tag $(VERSION) \ --name aws-okta-$(VERSION)-darwin-amd64 \ --replace \ --file $< +publish-github-darwin-bin-arm64: dist/aws-okta-$(VERSION)-darwin-arm64 | github-release + github-release upload \ + --user optimizely \ + --repo aws-okta \ + --tag $(VERSION) \ + --name aws-okta-$(VERSION)-darwin-arm64 \ + --replace \ + --file $< + publish-github-linux-bin: dist/aws-okta-$(VERSION)-linux-amd64 | github-release github-release upload \ - --security-token $$GH_LOGIN \ - --user segmentio \ + --user optimizely \ --repo aws-okta \ --tag $(VERSION) \ --name aws-okta-$(VERSION)-linux-amd64 \ @@ -83,8 +89,7 @@ publish-github-linux-bin: dist/aws-okta-$(VERSION)-linux-amd64 | github-release publish-github-deb: dist/aws-okta_$(VERSION)_amd64.deb | github-release github-release upload \ - --security-token $$GH_LOGIN \ - --user segmentio \ + --user optimizely \ --repo aws-okta \ --tag $(VERSION) \ --name aws-okta_$(VERSION)_amd64.deb \ @@ -93,8 +98,7 @@ publish-github-deb: dist/aws-okta_$(VERSION)_amd64.deb | github-release publish-github-rpm: dist/aws-okta_$(VERSION)_amd64.rpm | github-release github-release upload \ - --security-token $$GH_LOGIN \ - --user segmentio \ + --user optimizely \ --repo aws-okta \ --tag $(VERSION) \ --name aws-okta_$(VERSION)_amd64.rpm \ @@ -103,8 +107,7 @@ publish-github-rpm: dist/aws-okta_$(VERSION)_amd64.rpm | github-release publish-github-sha256sums: dist/aws-okta-$(VERSION).sha256sums | github-release github-release upload \ - --security-token $$GH_LOGIN \ - --user segmentio \ + --user optimizely \ --repo aws-okta \ --tag $(VERSION) \ --name aws-okta-$(VERSION).sha256sums \ @@ -120,24 +123,24 @@ packagecloud.conf.json: publish-packagecloud-deb: dist/aws-okta_$(VERSION)_amd64.deb packagecloud.conf.json @set -o pipefail; \ for v in $(PACKAGECLOUD_DEB_DISTROS); do \ - (package_cloud yank --config packagecloud.conf.json segment/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v aws-okta_$(VERSION_NO_V)_amd64.deb || true) | \ + (package_cloud yank --config packagecloud.conf.json optimizely/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v aws-okta_$(VERSION_NO_V)_amd64.deb || true) | \ grep -v 'with token:' || true ; \ - package_cloud push --config packagecloud.conf.json segment/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v $< | \ + package_cloud push --config packagecloud.conf.json optimizely/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v $< | \ grep -v 'with token:' ; \ done publish-packagecloud-rpm: dist/aws-okta_$(VERSION)_amd64.rpm packagecloud.conf.json @set -o pipefail; \ for v in $(PACKAGECLOUD_RPM_DISTROS); do \ - (package_cloud yank --config packagecloud.conf.json segment/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v aws-okta-$(subst -,_,$(VERSION_NO_V))-1.x86_64.rpm || true) | \ + (package_cloud yank --config packagecloud.conf.json optimizely/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v aws-okta-$(subst -,_,$(VERSION_NO_V))-1.x86_64.rpm || true) | \ grep -v 'with token:' || true ; \ - package_cloud push --config packagecloud.conf.json segment/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v $< | \ + package_cloud push --config packagecloud.conf.json optimizely/aws-okta$(PACKAGECLOUD_NAME_SUFFIX)/$$v $< | \ grep -v 'with token:' ; \ done dist: dist-darwin dist-linux dist/aws-okta-$(VERSION).sha256sums -dist-darwin: dist/aws-okta-$(VERSION)-darwin-amd64 +dist-darwin: dist/aws-okta-$(VERSION)-darwin-amd64 dist/aws-okta-$(VERSION)-darwin-arm64 dist-linux: dist/aws-okta-$(VERSION)-linux-amd64 dist/aws-okta_$(VERSION)_amd64.deb dist/aws-okta_$(VERSION)_amd64.rpm @@ -165,4 +168,5 @@ dist/aws-okta_$(VERSION)_amd64.rpm: dist/nfpm-$(VERSION).yaml dist/aws-okta-$(VE publish-github-deb \ publish-github-darwin \ publish-github-darwin-bin \ + publish-github-darwin-bin-arm64 \ github-release diff --git a/Makefile.tools b/Makefile.tools index c4cdd1d7..2db201ac 100644 --- a/Makefile.tools +++ b/Makefile.tools @@ -2,9 +2,9 @@ # # These are fragile, non-portable, and often require root # -NFPM_VERSION := 0.9.3 -#from https://github.com/goreleaser/nfpm/releases/download/v0.9.3/nfpm_0.9.3_checksums.txt -NFPM_SHA256 := f875ac060a30ec5c164e5444a7278322b276707493fa0ced6bfdd56640f0a6ea +NFPM_VERSION := 1.2.0 +#from https://github.com/goreleaser/nfpm/releases/download/v0.9.3/nfpm_1.2.0_checksums.txt +NFPM_SHA256 := 4659e714cc3d1fc1fa3ba75bb531901b0d2a89e5f59171145fb89bf1d392cb29 nfpm-debian: cd /tmp && \ @@ -21,17 +21,18 @@ rpmbuild-darwin: brew install rpm sha256sum-darwin: - brew install coreutils && ln -s $$(which gsha256sum) /usr/local/bin/sha256sum` + brew install coreutils && export PATH=/usr/local/opt/coreutils/libexec/gnubin:$PATH + # && ln -s $$(which gsha256sum) /usr/local/bin/sha256sum github-release: - GO111MODULE=off go get -u github.com/aktau/github-release + test -f /usr/local/bin/github-release || brew install github-release package_cloud: - gem install package_cloud + gem install package_cloud .PHONY: nfpm-debian \ rpmbuild-debian \ rpmbuild-darwin \ sha256sum-darwin \ github-release \ - package_cloud + package_cloud diff --git a/nfpm.yaml.tmpl b/nfpm.yaml.tmpl index 9ac5296a..cd4c7ec7 100644 --- a/nfpm.yaml.tmpl +++ b/nfpm.yaml.tmpl @@ -8,7 +8,7 @@ provides: - aws-okta vendor: 'Segment, Inc.' maintainer: tooling-team@segment.com -homepage: "https://github.com/segmentio/aws-okta" +homepage: "https://github.com/optimizely/aws-okta" license: "MIT" # IMHO packages should install to /usr/bin bindir: /usr/bin