Skip to content

0.7.0

0.7.0 #49

Workflow file for this run

name: Build Monokle-cli
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build_and_push:
runs-on: macos-latest
strategy:
matrix:
node-version: [16.15.1]
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Package
run: npm run package
- name: Build compressed archive files
id: archive
run: |
cp dist/monokle-cli-macos-amd64 monokle
tar -cvzf monokle-amd64.tar.gz monokle
rm -f monokle
cp dist/monokle-cli-macos-arm monokle
tar -cvzf monokle-arm.tar.gz monokle
AMD_SHA=$(shasum -a 256 monokle-amd64.tar.gz | awk '{print $1}')
ARM_SHA=$(shasum -a 256 monokle-arm.tar.gz | awk '{print $1}')
echo "::set-output name=AMD_SHA::$AMD_SHA"
echo "::set-output name=ARM_SHA::$ARM_SHA"
VERSION=$( echo ${{ github.ref }} | cut -d/ -f3 | cut -c2- )
echo $VERSION
echo "::set-output name=VERSION::$VERSION"
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload macOS amd binary to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/monokle-cli-macos-amd64
asset_name: monokle-cli-macos-amd64
asset_content_type: application/octet-stream
- name: Upload macOS arm binary to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/monokle-cli-macos-arm
asset_name: monokle-cli-macos-arm
asset_content_type: application/octet-stream
- name: Upload linux binary to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/monokle-cli-linux
asset_name: monokle-cli-linux
asset_content_type: application/octet-stream
- name: Upload windows binary to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/monokle-cli-win.exe
asset_name: monokle-cli-win.exe
asset_content_type: application/octet-stream
- name: Upload macOS amd64 tar.gz binary to Release
id: amd_file
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: monokle-amd64.tar.gz
asset_name: monokle-amd64.tar.gz
asset_content_type: application/octet-stream
- name: Upload macOS arm tar.gz binary to Release
id: arm_file
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: monokle-arm.tar.gz
asset_name: monokle-arm.tar.gz
asset_content_type: application/octet-stream
- name: Update brew manifest
env:
HOMEBREW_MONOKLE_TOKEN: ${{ secrets.HOMEBREW_MONOKLE_TOKEN }}
run: |
sed -i.bak "s#VERSION#${{ steps.archive.outputs.VERSION }}#g" manifest/monokle-cli.rb
sed -i.bak "s#AMD_URL#${{ steps.amd_file.outputs.browser_download_url }}#g" manifest/monokle-cli.rb
sed -i.bak "s#ARM_URL#${{ steps.arm_file.outputs.browser_download_url }}#g" manifest/monokle-cli.rb
sed -i.bak "s#AMD_SHA#${{ steps.archive.outputs.AMD_SHA }}#g" manifest/monokle-cli.rb
sed -i.bak "s#ARM_SHA#${{ steps.archive.outputs.ARM_SHA }}#g" manifest/monokle-cli.rb
SHA=$(curl -s -H "Authorization: token $HOMEBREW_MONOKLE_TOKEN" https://api.github.com/repos/kubeshop/homebrew-monokle/contents/Formula/monokle-cli.rb\?ref\=main | jq -r .sha)
CONTENT=$(base64 -i manifest/monokle-cli.rb)
curl -X PUT \
-H "Authorization: token $HOMEBREW_MONOKLE_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"message\": \"Updated monokle-cli.rb\", \"content\": \"$CONTENT\", \"sha\": \"$SHA\", \"branch\": \"main\"}" \
https://api.github.com/repos/kubeshop/homebrew-monokle/contents/Formula/monokle-cli.rb