From 80d2c1535a1cfdab5f09d801c1db6c99353f76ea Mon Sep 17 00:00:00 2001 From: umbynos Date: Wed, 30 Dec 2020 18:13:36 +0100 Subject: [PATCH 01/18] fix comment --- updater/updater.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/updater/updater.go b/updater/updater.go index 4b5faaf71..39786c0e8 100644 --- a/updater/updater.go +++ b/updater/updater.go @@ -68,7 +68,7 @@ func TempPath(path string) string { return path } -// TempPath generates the proper path for a temporary executable +// BinPath generates the proper path for a temporary executable (removing "-temp") func BinPath(path string) string { return strings.Replace(path, "-temp", "", -1) } From 7e51caefdbc2ad32593adb89f810e82d70359092 Mon Sep 17 00:00:00 2001 From: umbynos Date: Wed, 30 Dec 2020 18:16:24 +0100 Subject: [PATCH 02/18] add new error since DiffURL is not used (no patch bin) and optimize code Currently we only use BinURL for autoupdate (full bin) --- updater/updater.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/updater/updater.go b/updater/updater.go index 39786c0e8..0d339bf59 100644 --- a/updater/updater.go +++ b/updater/updater.go @@ -55,9 +55,10 @@ const ( const devValidTime = 7 * 24 * time.Hour var errHashMismatch = errors.New("new file hash mismatch after patch") +var errDiffUrlUndefined = errors.New("DiffURL is not defined, I cannot fetch and apply patch, reverting to full bin") var up = update.New() -// TempPath generates a temporary path for the executable +// TempPath generates a temporary path for the executable (adding "-temp") func TempPath(path string) string { if filepath.Ext(path) == "exe" { path = strings.Replace(path, ".exe", "-temp.exe", -1) @@ -141,6 +142,9 @@ func verifySha(bin []byte, sha []byte) bool { } func (u *Updater) fetchAndApplyPatch(old io.Reader) ([]byte, error) { + if u.DiffURL == "" { + return nil, errDiffUrlUndefined + } r, err := fetch(u.DiffURL + u.CmdName + "/" + u.CurrentVersion + "/" + u.Info.Version + "/" + plat) if err != nil { return nil, err @@ -238,12 +242,13 @@ func (u *Updater) update() error { } bin, err := u.fetchAndVerifyPatch(old) if err != nil { - if err == errHashMismatch { + switch err { + case errHashMismatch: log.Println("update: hash mismatch from patched binary") - } else { - if u.DiffURL != "" { - log.Println("update: patching binary,", err) - } + case errDiffUrlUndefined: + log.Println("update: ", err) + default: + log.Println("update: patching binary, ", err) } bin, err = u.fetchAndVerifyFullBin() From e89e0c229f3ab9e4b7833ad974cfae43b4c875cf Mon Sep 17 00:00:00 2001 From: umbynos Date: Thu, 31 Dec 2020 18:07:49 +0100 Subject: [PATCH 03/18] add first implementation of auto-update to release workflow (still to test) --- .github/workflows/release.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9462be1c..5b6443ed0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,17 +14,31 @@ jobs: - operating-system: ubuntu-18.04 - operating-system: windows-2019 arch: -386 + ext: ".exe" - operating-system: windows-2019 arch: -amd64 + ext: ".exe" - operating-system: macos-10.15 runs-on: ${{ matrix.operating-system }} + env: + TARGET: "/CreateBridge/" + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} steps: - name: Set version run: echo "TAG_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV shell: bash + - name: Identify Prerelease + # This is a workaround while waiting for create-release action to implement auto pre-release based on tag + id: prerelease + run: | + wget -q -P /tmp https://github.com/fsaintjacques/semver-tool/archive/3.1.0.zip + unzip -p /tmp/3.1.0.zip semver-tool-3.1.0/src/semver >/tmp/semver && chmod +x /tmp/semver + if [[ $(/tmp/semver get prerel ${GITHUB_REF/refs\/tags\//}) ]]; then echo "::set-output name=IS_PRE::true"; fi + - name: Disable EOL conversions run: git config --global core.autocrlf false @@ -48,6 +62,7 @@ jobs: run: | go get github.com/golangci/govet go get golang.org/x/lint/golint + go get -u github.com/sanbornm/go-selfupdate/... shell: bash - name: Install Taskfile @@ -97,6 +112,14 @@ jobs: run: task build if: matrix.operating-system == 'macos-10.15' + - name: Create autoupdate files + run: ${GOPATH}/bin/go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} # this will create `public/` dir with compressed full bin (/-.gz) and a json file + if: steps.prerelease.outputs.IS_PRE != 'true' + + - name: Upload autoupdate files to Arduino downloads servers + run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} --include "*" + if: steps.prerelease.outputs.IS_PRE != 'true' + # config.ini is required by the executable when it's run - name: Upload artifacts uses: actions/upload-artifact@v2 From 8d080751e946ce3dc297dd4b0dda563be1ae53e8 Mon Sep 17 00:00:00 2001 From: umbynos Date: Tue, 5 Jan 2021 17:07:04 +0100 Subject: [PATCH 04/18] try to release on /CreateAgent/ for testing purposes --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5b6443ed0..3c35dd733 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: runs-on: ${{ matrix.operating-system }} env: - TARGET: "/CreateBridge/" + TARGET: "/CreateAgent/" AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -114,11 +114,11 @@ jobs: - name: Create autoupdate files run: ${GOPATH}/bin/go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} # this will create `public/` dir with compressed full bin (/-.gz) and a json file - if: steps.prerelease.outputs.IS_PRE != 'true' + # if: steps.prerelease.outputs.IS_PRE != 'true' - name: Upload autoupdate files to Arduino downloads servers run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} --include "*" - if: steps.prerelease.outputs.IS_PRE != 'true' + # if: steps.prerelease.outputs.IS_PRE != 'true' # config.ini is required by the executable when it's run - name: Upload artifacts From 6475b3d35222aa68fa7ba8da413c2c772200b226 Mon Sep 17 00:00:00 2001 From: umbynos Date: Thu, 7 Jan 2021 15:15:26 +0100 Subject: [PATCH 05/18] windows do not come with wget changed also on create-release for uniformity --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c35dd733..3d400852d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,7 @@ jobs: # This is a workaround while waiting for create-release action to implement auto pre-release based on tag id: prerelease run: | - wget -q -P /tmp https://github.com/fsaintjacques/semver-tool/archive/3.1.0.zip + curl -L -s https://github.com/fsaintjacques/semver-tool/archive/3.1.0.zip -o /tmp/3.1.0.zip unzip -p /tmp/3.1.0.zip semver-tool-3.1.0/src/semver >/tmp/semver && chmod +x /tmp/semver if [[ $(/tmp/semver get prerel ${GITHUB_REF/refs\/tags\//}) ]]; then echo "::set-output name=IS_PRE::true"; fi @@ -400,7 +400,7 @@ jobs: # This is a workaround while waiting for create-release action to implement auto pre-release based on tag id: prerelease run: | - wget -q -P /tmp https://github.com/fsaintjacques/semver-tool/archive/3.1.0.zip + curl -L -s https://github.com/fsaintjacques/semver-tool/archive/3.1.0.zip -o /tmp/3.1.0.zip unzip -p /tmp/3.1.0.zip semver-tool-3.1.0/src/semver >/tmp/semver && chmod +x /tmp/semver if [[ $(/tmp/semver get prerel ${GITHUB_REF/refs\/tags\//}) ]]; then echo "::set-output name=IS_PRE::true"; fi From 6ba1c2f38a16b25df7f14fbd8de8637287dd1c8f Mon Sep 17 00:00:00 2001 From: umbynos Date: Tue, 5 Jan 2021 17:46:05 +0100 Subject: [PATCH 06/18] fix go-selfupdate not being found --- .github/workflows/release.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3d400852d..456d194b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,8 +27,10 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} steps: - - name: Set version - run: echo "TAG_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV + - name: Set env vars + run: | + echo "TAG_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV + echo $(go env GOPATH)/bin >> $GITHUB_PATH shell: bash - name: Identify Prerelease @@ -113,7 +115,7 @@ jobs: if: matrix.operating-system == 'macos-10.15' - name: Create autoupdate files - run: ${GOPATH}/bin/go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} # this will create `public/` dir with compressed full bin (/-.gz) and a json file + run: go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} # this will create `public/` dir with compressed full bin (/-.gz) and a json file # if: steps.prerelease.outputs.IS_PRE != 'true' - name: Upload autoupdate files to Arduino downloads servers From edecef4346e7bfdae02449421dad4d30e2b528c2 Mon Sep 17 00:00:00 2001 From: umbynos Date: Tue, 5 Jan 2021 17:19:31 +0100 Subject: [PATCH 07/18] use globally bash (for win compatibility) and move comment --- .github/workflows/release.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 456d194b2..8caf4d1a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,6 +20,10 @@ jobs: ext: ".exe" - operating-system: macos-10.15 + defaults: + run: + shell: bash + runs-on: ${{ matrix.operating-system }} env: TARGET: "/CreateAgent/" @@ -31,7 +35,6 @@ jobs: run: | echo "TAG_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV echo $(go env GOPATH)/bin >> $GITHUB_PATH - shell: bash - name: Identify Prerelease # This is a workaround while waiting for create-release action to implement auto pre-release based on tag @@ -65,7 +68,6 @@ jobs: go get github.com/golangci/govet go get golang.org/x/lint/golint go get -u github.com/sanbornm/go-selfupdate/... - shell: bash - name: Install Taskfile uses: arduino/actions/setup-taskfile@master @@ -114,8 +116,9 @@ jobs: run: task build if: matrix.operating-system == 'macos-10.15' + # this will create `public/` dir with compressed full bin (/-.gz) and a json file - name: Create autoupdate files - run: go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} # this will create `public/` dir with compressed full bin (/-.gz) and a json file + run: go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} # if: steps.prerelease.outputs.IS_PRE != 'true' - name: Upload autoupdate files to Arduino downloads servers From 46ae0a4d77a473ca5c243c36487e960ca1a8bd3e Mon Sep 17 00:00:00 2001 From: umbynos Date: Thu, 7 Jan 2021 13:36:14 +0100 Subject: [PATCH 08/18] found cause of failure on win and add debug --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8caf4d1a3..760a8ab97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,6 +29,7 @@ jobs: TARGET: "/CreateAgent/" AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_EC2_METADATA_DISABLED: true #https://github.com/aws/aws-cli/issues/5623 steps: - name: Set env vars @@ -122,7 +123,7 @@ jobs: # if: steps.prerelease.outputs.IS_PRE != 'true' - name: Upload autoupdate files to Arduino downloads servers - run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} --include "*" + run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} --debug # if: steps.prerelease.outputs.IS_PRE != 'true' # config.ini is required by the executable when it's run From 8d64b9503d7ec866ac2744d181a348e0d3ddcd7d Mon Sep 17 00:00:00 2001 From: umbynos Date: Thu, 7 Jan 2021 16:52:21 +0100 Subject: [PATCH 09/18] set region, instead of AWS_EC2_METADATA_DISABLED (undocumented) --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 760a8ab97..ae9d5f5f2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: TARGET: "/CreateAgent/" AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_EC2_METADATA_DISABLED: true #https://github.com/aws/aws-cli/issues/5623 + AWS_REGION: "us-east-1" # or https://github.com/aws/aws-cli/issues/5623 steps: - name: Set env vars From 506a1ca3a1aa35705719f0f6b9a5e543f84fb838 Mon Sep 17 00:00:00 2001 From: umbynos Date: Thu, 7 Jan 2021 17:28:18 +0100 Subject: [PATCH 10/18] refactor goarch=386 because of go-selfupdate --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae9d5f5f2..bdbfd161a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,7 @@ jobs: - operating-system: ubuntu-18.04 - operating-system: windows-2019 arch: -386 + goarch: 386 # 32bit architecture (for support) ext: ".exe" - operating-system: windows-2019 arch: -amd64 @@ -35,7 +36,8 @@ jobs: - name: Set env vars run: | echo "TAG_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV - echo $(go env GOPATH)/bin >> $GITHUB_PATH + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + echo "GOARCH:=${{ matrix.goarch }}" >> $GITHUB_ENV - name: Identify Prerelease # This is a workaround while waiting for create-release action to implement auto pre-release based on tag @@ -100,7 +102,6 @@ jobs: # building the agent for win requires a different task because of an extra flag - name: Build the Agent for win32 env: - GOARCH: 386 # 32bit architecture (for support) GO386: 387 # support old instruction sets without MMX (used in the Pentium 4) (will be deprecated in GO > 1.15 https://golang.org/doc/go1.15) run: task build-win if: matrix.operating-system == 'windows-2019' && matrix.arch == '-386' From 5ba5bd871ecc0caaee686b5fd793243adebe13e9 Mon Sep 17 00:00:00 2001 From: umbynos Date: Thu, 7 Jan 2021 17:44:14 +0100 Subject: [PATCH 11/18] Revert "refactor goarch=386 because of go-selfupdate" This reverts commit 506a1ca3a1aa35705719f0f6b9a5e543f84fb838. --- .github/workflows/release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bdbfd161a..ae9d5f5f2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,6 @@ jobs: - operating-system: ubuntu-18.04 - operating-system: windows-2019 arch: -386 - goarch: 386 # 32bit architecture (for support) ext: ".exe" - operating-system: windows-2019 arch: -amd64 @@ -36,8 +35,7 @@ jobs: - name: Set env vars run: | echo "TAG_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - echo "GOARCH:=${{ matrix.goarch }}" >> $GITHUB_ENV + echo $(go env GOPATH)/bin >> $GITHUB_PATH - name: Identify Prerelease # This is a workaround while waiting for create-release action to implement auto pre-release based on tag @@ -102,6 +100,7 @@ jobs: # building the agent for win requires a different task because of an extra flag - name: Build the Agent for win32 env: + GOARCH: 386 # 32bit architecture (for support) GO386: 387 # support old instruction sets without MMX (used in the Pentium 4) (will be deprecated in GO > 1.15 https://golang.org/doc/go1.15) run: task build-win if: matrix.operating-system == 'windows-2019' && matrix.arch == '-386' From c88224931a0368bfbbd5c242031a6b3a018a00f6 Mon Sep 17 00:00:00 2001 From: umbynos Date: Thu, 7 Jan 2021 17:47:26 +0100 Subject: [PATCH 12/18] try different approach: duplicate step --- .github/workflows/release.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae9d5f5f2..d1773a46a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -120,7 +120,13 @@ jobs: # this will create `public/` dir with compressed full bin (/-.gz) and a json file - name: Create autoupdate files run: go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} - # if: steps.prerelease.outputs.IS_PRE != 'true' + if: matrix.arch != '-386' && # steps.prerelease.outputs.IS_PRE != 'true' + + - name: Create autoupdate files for win32 + env: + GOARCH: 386 + run: go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} + if: matrix.arch == '-386' && # steps.prerelease.outputs.IS_PRE != 'true' - name: Upload autoupdate files to Arduino downloads servers run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} --debug From 89f1b061fe9dbccc0ba5d99aa95a22226df658b5 Mon Sep 17 00:00:00 2001 From: umbynos Date: Thu, 7 Jan 2021 17:50:19 +0100 Subject: [PATCH 13/18] comment do not work here --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1773a46a..80dab3f3f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -120,13 +120,13 @@ jobs: # this will create `public/` dir with compressed full bin (/-.gz) and a json file - name: Create autoupdate files run: go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} - if: matrix.arch != '-386' && # steps.prerelease.outputs.IS_PRE != 'true' + if: matrix.arch != '-386' - name: Create autoupdate files for win32 env: GOARCH: 386 run: go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} - if: matrix.arch == '-386' && # steps.prerelease.outputs.IS_PRE != 'true' + if: matrix.arch == '-386' - name: Upload autoupdate files to Arduino downloads servers run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} --debug From f3180770a7a2417ba2649bda229322c44c6aa92d Mon Sep 17 00:00:00 2001 From: umbynos Date: Thu, 7 Jan 2021 18:11:37 +0100 Subject: [PATCH 14/18] setting GOARCH does not seem to work -> use -platform instead --- .github/workflows/release.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 80dab3f3f..634edf9da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -123,9 +123,7 @@ jobs: if: matrix.arch != '-386' - name: Create autoupdate files for win32 - env: - GOARCH: 386 - run: go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} + run: go-selfupdate -platform windows${{ matrix.arch }} arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} if: matrix.arch == '-386' - name: Upload autoupdate files to Arduino downloads servers From 5e6e2768892267155f24a4713b355184076b8a62 Mon Sep 17 00:00:00 2001 From: umbynos Date: Thu, 7 Jan 2021 18:17:22 +0100 Subject: [PATCH 15/18] remove --debug --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 634edf9da..f81efe175 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -127,7 +127,7 @@ jobs: if: matrix.arch == '-386' - name: Upload autoupdate files to Arduino downloads servers - run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} --debug + run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} # if: steps.prerelease.outputs.IS_PRE != 'true' # config.ini is required by the executable when it's run From 0c62cc74b4d61ffc8b92a8677075ddb948eff52a Mon Sep 17 00:00:00 2001 From: umbynos Date: Fri, 8 Jan 2021 12:51:18 +0100 Subject: [PATCH 16/18] uniform test.yml to release.yml --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5e082621a..27f78908a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,9 @@ jobs: - operating-system: windows-2019 arch: -amd64 - operating-system: macos-10.15 + defaults: + run: + shell: bash runs-on: ${{ matrix.operating-system }} @@ -41,7 +44,6 @@ jobs: run: | go get github.com/golangci/govet go get golang.org/x/lint/golint - shell: bash - name: Install Taskfile uses: arduino/actions/setup-taskfile@master From 54ddc27ded4659db4da9e027f7687b432b4798c8 Mon Sep 17 00:00:00 2001 From: umbynos Date: Fri, 8 Jan 2021 13:09:49 +0100 Subject: [PATCH 17/18] use env global variables https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#env --- .github/workflows/release.yml | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f81efe175..73980790f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,16 @@ on: tags: - "[0-9]+.[0-9]+.[0-9]+*" +env: + TARGET: "/CreateAgent/" + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: "us-east-1" # or https://github.com/aws/aws-cli/issues/5623 + KEYCHAIN: "sign.keychain" + INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12" + AC_USERNAME: ${{ secrets.AC_USERNAME }} + AC_PASSWORD: ${{ secrets.AC_PASSWORD }} + jobs: # The build job is responsible for: configuring the environment, testing and compiling process build: @@ -25,11 +35,6 @@ jobs: shell: bash runs-on: ${{ matrix.operating-system }} - env: - TARGET: "/CreateAgent/" - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: "us-east-1" # or https://github.com/aws/aws-cli/issues/5623 steps: - name: Set env vars @@ -155,9 +160,6 @@ jobs: path: arduino-create-agent-${{ env.RUNS_ON }} - name: Import Code-Signing Certificates - env: - KEYCHAIN: "sign.keychain" - INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12" run: | echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > ${{ env.INSTALLER_CERT_MAC_PATH }} security create-keychain -p ${{ secrets.KEYCHAIN_PASSWORD }} ${{ env.KEYCHAIN }} @@ -188,9 +190,6 @@ jobs: EOF - name: Code sign and notarize app - env: - AC_USERNAME: ${{ secrets.AC_USERNAME }} - AC_PASSWORD: ${{ secrets.AC_PASSWORD }} run: | echo "gon will notarize executable in arduino-create-agent-${{ env.RUNS_ON }}/arduino-create-agent" gon -log-level=debug -log-json gon.config.hcl @@ -341,9 +340,6 @@ jobs: run: chmod -v +x ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app/Contents/MacOS/* - name: Import Code-Signing Certificates - env: - KEYCHAIN: "sign.keychain" - INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12" run: | echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > ${{ env.INSTALLER_CERT_MAC_PATH }} security create-keychain -p ${{ secrets.KEYCHAIN_PASSWORD }} ${{ env.KEYCHAIN }} @@ -375,9 +371,6 @@ jobs: EOF - name: Code sign and notarize app - env: - AC_USERNAME: ${{ secrets.AC_USERNAME }} - AC_PASSWORD: ${{ secrets.AC_PASSWORD }} run: | echo "gon will notarize executable in ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app" gon -log-level=debug -log-json gon.config_installer.hcl @@ -397,10 +390,6 @@ jobs: create-release: runs-on: ubuntu-18.04 needs: code-sign-mac-installers - env: - TARGET: "/CreateBridgeStable/" - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} steps: - name: Download artifact From b580a8f7a11c9dd019ceb3c15065c931263dab5c Mon Sep 17 00:00:00 2001 From: umbynos Date: Fri, 8 Jan 2021 15:28:28 +0100 Subject: [PATCH 18/18] add again check on prerelease --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73980790f..4ca98a0b1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,8 +12,8 @@ env: AWS_REGION: "us-east-1" # or https://github.com/aws/aws-cli/issues/5623 KEYCHAIN: "sign.keychain" INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12" - AC_USERNAME: ${{ secrets.AC_USERNAME }} - AC_PASSWORD: ${{ secrets.AC_PASSWORD }} + AC_USERNAME: ${{ secrets.AC_USERNAME }} # used by gon + AC_PASSWORD: ${{ secrets.AC_PASSWORD }} # used by gon jobs: # The build job is responsible for: configuring the environment, testing and compiling process @@ -125,15 +125,15 @@ jobs: # this will create `public/` dir with compressed full bin (/-.gz) and a json file - name: Create autoupdate files run: go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} - if: matrix.arch != '-386' + if: matrix.arch != '-386' && steps.prerelease.outputs.IS_PRE != 'true' - name: Create autoupdate files for win32 run: go-selfupdate -platform windows${{ matrix.arch }} arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} - if: matrix.arch == '-386' + if: matrix.arch == '-386' && steps.prerelease.outputs.IS_PRE != 'true' - name: Upload autoupdate files to Arduino downloads servers run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} - # if: steps.prerelease.outputs.IS_PRE != 'true' + if: steps.prerelease.outputs.IS_PRE != 'true' # config.ini is required by the executable when it's run - name: Upload artifacts