get k6 during build #41
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Manual Release' | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
publish-studio: | ||
permissions: | ||
contents: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# linux disabled until we get to work to support it | ||
#platform: [macos-latest, ubuntu-20.04, windows-latest] | ||
platform: [macos-latest, windows-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# get k6 binaries macos | ||
- name: get latest k6 binary macos | ||
if: startsWith(matrix.platform, 'macos-') | ||
run: | | ||
K6_PATH_AMD=k6-${{ vars.K6_VERSION }}-macos-amd64 | ||
K6_PATH_ARM=k6-${{ vars.K6_VERSION }}-macos-arm64 | ||
# download binaries | ||
curl -LO https://github.com/grafana/k6/releases/download/${{ vars.K6_VERSION }}/$K6_PATH_AMD.zip | ||
curl -LO https://github.com/grafana/k6/releases/download/${{ vars.K6_VERSION }}/$K6_PATH_ARM.zip | ||
# unzip & smoke test | ||
unzip $K6_PATH_AMD.zip | ||
unzip $K6_PATH_ARM.zip | ||
$K6_PATH_AMD/k6 version | ||
$K6_PATH_ARM/k6 version | ||
# move to resource folder | ||
mv $K6_PATH_AMD/k6 resources/mac/x86_64 | ||
mv $K6_PATH_ARM/k6 resources/mac/arm64 | ||
# get k6 binaries windows | ||
- name: get latest k6 binary windows | ||
if: startsWith(matrix.platform, 'windows-') | ||
run: | | ||
$K6_PATH_AMD="k6-${{ vars.K6_VERSION }}-windows-amd64" | ||
# download binaries | ||
Invoke-WebRequest -Uri "https://github.com/grafana/k6/releases/download/${{ vars.K6_VERSION }}/$K6_PATH_AMD.zip" -OutFile "k6-windows-amd64.zip" | ||
# unzip & smoke test | ||
Expand-Archive -Path "k6-windows-amd64.zip" -DestinationPath "." | ||
& $K6_PATH_AMD\k6.exe version | ||
# move to resource folder | ||
Move-Item -Path "$K6_PATH_AMD\k6.exe" -Destination resources\win\x86_64 | ||
- name: setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
# try earlier python version for appdmg | ||
# https://github.com/electron/forge/issues/3371#issuecomment-2105195302 | ||
- name: Install Python 3.11.4 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11.4' | ||
- name: install dependencies | ||
run: npm ci | ||
- name: setup macos keychain | ||
if: startsWith(matrix.platform, 'macos-') | ||
run: | | ||
echo "$APPLE_API_KEY" > ./apple_api_key.p8 | ||
echo $APPLE_CERTIFICATE_P12 | base64 --decode > certificate.p12 | ||
security create-keychain -p "$CERTIFICATE_PASSWORD" build.keychain | ||
security default-keychain -s build.keychain | ||
security unlock-keychain -p "$CERTIFICATE_PASSWORD" build.keychain | ||
security import certificate.p12 -k build.keychain -P "$CERTIFICATE_PASSWORD" -T /usr/bin/codesign | ||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$CERTIFICATE_PASSWORD" build.keychain | ||
env: | ||
APPLE_CERTIFICATE_P12: ${{ secrets.APPLE_CERTIFICATE_P12 }} | ||
CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_P12_PASSWORD }} | ||
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} | ||
- name: setup windows certificate | ||
if: startsWith(matrix.platform, 'windows-') | ||
run: | | ||
$bytes = [Convert]::FromBase64String("${{ secrets.WINDOWS_CERTIFICATE }}") | ||
[IO.File]::WriteAllBytes("certificate.pfx", $bytes) | ||
env: | ||
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }} | ||
- name: publish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# notarization | ||
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} | ||
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} | ||
APPLE_API_KEY: ./apple_api_key.p8 | ||
# windows cert | ||
WINDOWS_CERTIFICATE_PATH: ./certificate.pfx | ||
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} | ||
run: npm run publish | ||
- name: cleanup macos certificates | ||
if: startsWith(matrix.platform, 'macos-') | ||
run: | | ||
rm apple_api_key.p8 | ||
rm certificate.p12 | ||
- name: cleanup windows certificates | ||
if: startsWith(matrix.platform, 'windows-') | ||
run: | | ||
del certificate.pfx |