Skip to content

Commit

Permalink
Restructure GHA workflow
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
Ivan Mirić committed Jan 19, 2021
1 parent 0d58423 commit 0f37064
Showing 1 changed file with 67 additions and 40 deletions.
107 changes: 67 additions & 40 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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"

0 comments on commit 0f37064

Please sign in to comment.