From 0d584238426293e0fc90444b8f0dc90a3f59b708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Tue, 19 Jan 2021 11:58:40 +0100 Subject: [PATCH 1/5] Fix brew bump-formula-pr command The formula now uses a URL and SHA of the .zip package. --- .github/workflows/all.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index ce6c69efa9a..dabbbceed91 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -349,7 +349,10 @@ jobs: env: VERSION: ${{ needs.configure.outputs.version }} steps: + - name: Download source code archive + run: curl -fsSL "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/archive/${VERSION}.tar.gz" -o "${VERSION}.tar.gz" - name: Set up Homebrew uses: Homebrew/actions/setup-homebrew@2eb78889a50ba021d744837934f1af2d8c4458ec - name: Create version bump PR - run: brew bump-formula-pr k6 --tag="$VERSION" --revision="$GITHUB_SHA" + run: brew bump-formula-pr k6 --url="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/archive/${VERSION}.tar.gz" \ + --sha256="$(shasum -a 256 ${VERSION}.tar.gz | cut -d' ' -f1)" From 0f37064c77fd59bab9902bde8a7a39c65660d868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Tue, 19 Jan 2021 13:04:11 +0100 Subject: [PATCH 2/5] Restructure GHA workflow - Upload Windows packages as GHA artifacts so that they can be made part of the GH release (#1750). - Upload Bintray packages in a single job. --- .github/workflows/all.yml | 107 ++++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 40 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index dabbbceed91..1c3ee04e87c 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -243,40 +243,7 @@ jobs: docker push "$DOCKER_IMAGE_ID:latest" fi - publish-github: - runs-on: ubuntu-latest - needs: [deps, lint, test, test-cov, configure, build] - if: startsWith(github.ref, 'refs/tags/v') - env: - VERSION: ${{ needs.configure.outputs.version }} - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Download binaries - uses: actions/download-artifact@v2 - with: - name: binaries - path: dist - - name: Create release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -x - assets=() - for asset in ./dist/*; do - assets+=("-a" "$asset") - done - hub release create "${assets[@]}" -m "$VERSION" -m "$(cat ./release\ notes/${VERSION}.md)" "$VERSION" - - name: Upload packages to Bintray - run: | - # Publishing deb - curl --fail -H "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -T "dist/k6-$VERSION-amd64.deb" \ - "https://${{ secrets.BINTRAY_USER }}:${{ secrets.BINTRAY_KEY }}@api.bintray.com/content/loadimpact/deb/k6/${VERSION#v}/k6-${VERSION}-amd64.deb;deb_distribution=stable;deb_component=main;deb_architecture=amd64;publish=1;override=1" - # Publishing rpm - curl --fail -H "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -T "dist/k6-$VERSION-amd64.rpm" \ - "https://${{ secrets.BINTRAY_USER }}:${{ secrets.BINTRAY_KEY }}@api.bintray.com/content/loadimpact/rpm/k6/${VERSION#v}/k6-${VERSION}-amd64.rpm?publish=1&override=1" - - publish-windows: + package-windows: runs-on: windows-latest defaults: run: @@ -335,12 +302,14 @@ jobs: uses: crazy-max/ghaction-chocolatey@b6061d587628735be315d74358228b83a7dba9a7 with: args: pack --verbose --outputdirectory .\packaging .\packaging\k6.portable.nuspec - - name: Upload packages to Bintray - run: | - cd .\packaging - $env:VERSION = $env:VERSION.TrimStart("v", " ") - curl.exe --fail -H "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -T .\k6.msi "https://${{ secrets.BINTRAY_USER }}:${{ secrets.BINTRAY_KEY }}@api.bintray.com/content/loadimpact/windows/k6/$env:VERSION/k6-v$env:VERSION-amd64.msi?publish=1&override=1" - curl.exe --fail -H "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -T .\k6.portable.$env:VERSION.nupkg "https://${{ secrets.BINTRAY_USER }}:${{ secrets.BINTRAY_KEY }}@api.bintray.com/content/loadimpact/choco/k6.portable/$env:VERSION/k6.portable.$env:VERSION.nupkg?publish=1&override=1" + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: binaries-windows + path: | + packaging/k6.msi + packaging/k6.*.nupkg + retention-days: 7 publish-macos: runs-on: macos-latest @@ -356,3 +325,61 @@ jobs: - name: Create version bump PR run: brew bump-formula-pr k6 --url="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/archive/${VERSION}.tar.gz" \ --sha256="$(shasum -a 256 ${VERSION}.tar.gz | cut -d' ' -f1)" + + publish-github: + runs-on: ubuntu-latest + needs: [configure, deps, lint, test, test-cov, build, package-windows] + if: startsWith(github.ref, 'refs/tags/v') + env: + VERSION: ${{ needs.configure.outputs.version }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Download binaries + uses: actions/download-artifact@v2 + with: + name: binaries + path: dist + - name: Download Windows binaries + uses: actions/download-artifact@v2 + with: + name: binaries-windows + path: dist + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -x + assets=() + for asset in ./dist/*; do + assets+=("-a" "$asset") + done + hub release create "${assets[@]}" -m "$VERSION" -m "$(cat ./release\ notes/${VERSION}.md)" "$VERSION" + + publish-bintray: + runs-on: ubuntu-latest + needs: [configure, build, package-windows] + if: startsWith(github.ref, 'refs/tags/v') + env: + VERSION: ${{ needs.configure.outputs.version }} + steps: + - name: Download binaries + uses: actions/download-artifact@v2 + with: + name: binaries + path: dist + - name: Download Windows binaries + uses: actions/download-artifact@v2 + with: + name: binaries-windows + path: dist + - name: Upload packages to Bintray + run: | + curl -fsS -H "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -T "dist/k6-$VERSION-amd64.deb" \ + "https://${{ secrets.BINTRAY_USER }}:${{ secrets.BINTRAY_KEY }}@api.bintray.com/content/loadimpact/deb/k6/${VERSION#v}/k6-${VERSION}-amd64.deb;deb_distribution=stable;deb_component=main;deb_architecture=amd64;publish=1;override=1" + curl -fsS -H "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -T "dist/k6-$VERSION-amd64.rpm" \ + "https://${{ secrets.BINTRAY_USER }}:${{ secrets.BINTRAY_KEY }}@api.bintray.com/content/loadimpact/rpm/k6/${VERSION#v}/k6-${VERSION}-amd64.rpm?publish=1&override=1" + curl -fsS -H "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -T "dist/k6.msi" \ + "https://${{ secrets.BINTRAY_USER }}:${{ secrets.BINTRAY_KEY }}@api.bintray.com/content/loadimpact/windows/k6/${VERSION#v}/k6-${VERSION}-amd64.msi?publish=1&override=1" + curl -fsS -H "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -T "dist/k6.portable.${VERSION#v}.nupkg" \ + "https://${{ secrets.BINTRAY_USER }}:${{ secrets.BINTRAY_KEY }}@api.bintray.com/content/loadimpact/choco/k6.portable/${VERSION#v}/k6.portable.${VERSION}.nupkg?publish=1&override=1" From e73c1414ace6d5384d1167bf4803b03f9118ada6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Tue, 19 Jan 2021 15:26:43 +0100 Subject: [PATCH 3/5] Rename MSI artifact --- .github/workflows/all.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 1c3ee04e87c..fc87691fd9a 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -302,12 +302,15 @@ jobs: uses: crazy-max/ghaction-chocolatey@b6061d587628735be315d74358228b83a7dba9a7 with: args: pack --verbose --outputdirectory .\packaging .\packaging\k6.portable.nuspec + - name: Rename MSI package + # To keep it consistent with the other artifacts + run: move "packaging\k6.msi" "packaging\k6-$env:VERSION-win64.msi" - name: Upload artifacts uses: actions/upload-artifact@v2 with: name: binaries-windows path: | - packaging/k6.msi + packaging/k6-*.msi packaging/k6.*.nupkg retention-days: 7 @@ -379,7 +382,7 @@ jobs: "https://${{ secrets.BINTRAY_USER }}:${{ secrets.BINTRAY_KEY }}@api.bintray.com/content/loadimpact/deb/k6/${VERSION#v}/k6-${VERSION}-amd64.deb;deb_distribution=stable;deb_component=main;deb_architecture=amd64;publish=1;override=1" curl -fsS -H "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -T "dist/k6-$VERSION-amd64.rpm" \ "https://${{ secrets.BINTRAY_USER }}:${{ secrets.BINTRAY_KEY }}@api.bintray.com/content/loadimpact/rpm/k6/${VERSION#v}/k6-${VERSION}-amd64.rpm?publish=1&override=1" - curl -fsS -H "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -T "dist/k6.msi" \ + curl -fsS -H "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -T "dist/k6-$VERSION-win64.msi" \ "https://${{ secrets.BINTRAY_USER }}:${{ secrets.BINTRAY_KEY }}@api.bintray.com/content/loadimpact/windows/k6/${VERSION#v}/k6-${VERSION}-amd64.msi?publish=1&override=1" curl -fsS -H "X-GPG-PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}" -T "dist/k6.portable.${VERSION#v}.nupkg" \ "https://${{ secrets.BINTRAY_USER }}:${{ secrets.BINTRAY_KEY }}@api.bintray.com/content/loadimpact/choco/k6.portable/${VERSION#v}/k6.portable.${VERSION}.nupkg?publish=1&override=1" From b05d98d8bae20eab27ba5239b4606f18184d0470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Tue, 19 Jan 2021 15:27:31 +0100 Subject: [PATCH 4/5] Remove Chocolatey package from GH release --- .github/workflows/all.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index fc87691fd9a..a8b305c5c71 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -348,6 +348,8 @@ jobs: with: name: binaries-windows path: dist + - name: Remove Chocolatey package + run: rm dist/k6*.nupkg - name: Create release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 5f57b5ad792c0ad482a39a9b5ba1adb0f08a0329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Miri=C4=87?= Date: Tue, 19 Jan 2021 15:46:39 +0100 Subject: [PATCH 5/5] Fix checksum file generation Part of #1750 Since we're merging the MSI package with the other built artifacts it's simpler to generate the checksum file right before creating the GH release. --- .github/workflows/all.yml | 2 ++ build-release.sh | 18 ------------------ 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index a8b305c5c71..70590b1de6d 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -350,6 +350,8 @@ jobs: path: dist - name: Remove Chocolatey package run: rm dist/k6*.nupkg + - name: Generate checksum file + run: cd dist && sha256sum * > "k6-${VERSION}-checksums.txt" - name: Create release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build-release.sh b/build-release.sh index 3a58008150d..4123eff0ed4 100755 --- a/build-release.sh +++ b/build-release.sh @@ -58,22 +58,6 @@ package() { esac } -CHECKSUM_FILE="k6-${VERSION}-checksums.txt" -checksum() { - if command -v sha256sum > /dev/null; then - CHECKSUM_CMD=("sha256sum") - elif command -v shasum > /dev/null; then - CHECKSUM_CMD=("shasum" "-a" "256") - else - echo "ERROR: unable to find a command to compute sha-256 hash" - exit 1 - fi - - echo "--- Generating checksum file..." - rm -f "${OUT_DIR}/$CHECKSUM_FILE" - (cd "$OUT_DIR" && find . -maxdepth 1 -type f -printf '%P\n' | sort | xargs "${CHECKSUM_CMD[@]}" > "$CHECKSUM_FILE") -} - cleanup() { find "$OUT_DIR" -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} \; echo "--- Cleaned ${OUT_DIR}" @@ -97,5 +81,3 @@ package linux64 deb package mac zip package win32 zip package win64 zip - -checksum