From b23e654fe32d19bfeb6a7d28716236e3c48e5ade Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Tue, 22 Feb 2022 12:00:12 -0500 Subject: [PATCH] Use gh upload/dl instead of s3. don't run publish/smoke for external PRs --- .github/workflows/main.yml | 50 +++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e39f440dd..567ede8b4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,12 +35,16 @@ jobs: - name: Build and Test run: | - pip install --upgrade pip - pip install awscli go install github.com/mitchellh/gox@latest $(go env GOPATH)/bin/ziti-ci generate-build-info common/version/info_generated.go version - CGO_ENABLED=true $(go env GOPATH)/bin/gox -os=darwin -arch=amd64 -output=$GOX_OUTPUT ./... - aws s3 sync --no-progress release/ s3://ziti-cmd-build-tmp/${{ github.run_id }} + $(go env GOPATH)/bin/gox -cgo -os=darwin -arch=amd64 -output=$GOX_OUTPUT ./... + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: darwin-release + path: release/ + retention-days: 5 windows-build: name: Build Windows binaries @@ -62,13 +66,16 @@ jobs: - name: Build and Test shell: bash run: | - choco install python --version 3.6.8 - python -m pip install --upgrade pip - pip install awscli go install github.com/mitchellh/gox@latest $(go env GOPATH)/bin/ziti-ci generate-build-info common/version/info_generated.go version - CGO_ENABLED=true $(go env GOPATH)/bin/gox -os=windows -arch=amd64 -output=$GOX_OUTPUT ./... - aws s3 sync --no-progress release/ s3://ziti-cmd-build-tmp/${{ github.run_id }} + $(go env GOPATH)/bin/gox -cgo -os=windows -arch=amd64 -output=$GOX_OUTPUT ./... + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: windows-release + path: release/ + retention-days: 5 tag-and-publish: name: Build Linux Binaries and Docker Image, Tag, and Publish @@ -99,19 +106,27 @@ jobs: run: | sudo apt-get update sudo apt-get -yq install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf gcc-aarch64-linux-gnu - python -m pip install --upgrade pip - pip install awscli $(go env GOPATH)/bin/ziti-ci configure-git $(go env GOPATH)/bin/ziti-ci generate-build-info common/version/info_generated.go version go install github.com/mitchellh/gox@latest - CGO_ENABLED=true $(go env GOPATH)/bin/gox -os=linux -arch=amd64 -output=$GOX_OUTPUT ./... - CC=arm-linux-gnueabihf-gcc CGO_ENABLED=true $(go env GOPATH)/bin/gox -cgo -os=linux -arch=arm -output=$GOX_OUTPUT ./... - CC=aarch64-linux-gnu-gcc CGO_ENABLED=true $(go env GOPATH)/bin/gox -cgo -os=linux -arch=arm64 -output=$GOX_OUTPUT ./... - aws s3 sync --no-progress s3://ziti-cmd-build-tmp/${{ github.run_id }} release/ - aws s3 rm --recursive s3://ziti-cmd-build-tmp/${{ github.run_id }} + $(go env GOPATH)/bin/gox -cgo -os=linux -arch=amd64 -output=$GOX_OUTPUT ./... + CC=arm-linux-gnueabihf-gcc $(go env GOPATH)/bin/gox -cgo -os=linux -arch=arm -output=$GOX_OUTPUT ./... + CC=aarch64-linux-gnu-gcc $(go env GOPATH)/bin/gox -cgo -os=linux -arch=arm64 -output=$GOX_OUTPUT ./... + + - name: Download darwin release artifact + uses: actions/download-artifact@v2 + with: + name: darwin-release + path: release/ + + - name: Download windows release artifact + uses: actions/download-artifact@v2 + with: + name: windows-release + path: release/ - name: Publish - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-v') + if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-v')) && github.repository_owner == 'openziti' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -119,6 +134,7 @@ jobs: $(go env GOPATH)/bin/ziti-ci publish-to-github - name: Trigger Smoketest + if: github.repository_owner == 'openziti' env: JFROG_API_KEY: ${{ secrets.JFROG_API_KEY }} jenkins_user: ${{ secrets.JENKINS_USER }}