Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions .github/workflows/build-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ jobs:
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles

- name: Set version in code (Unix)
if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' || matrix.os == 'macos-13'
if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' || matrix.os == 'macos-13'
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
awk 'NR==3{$0="__version__ = \"'${{ github.ref_name }}'\""}1' ./robusta_krr/__init__.py > temp && mv temp ./robusta_krr/__init__.py
awk -v ver="$GITHUB_REF_NAME" 'NR==3{$0="__version__ = \"" ver "\""}1' ./robusta_krr/__init__.py > temp && mv temp ./robusta_krr/__init__.py
Comment thread
moshemorad marked this conversation as resolved.
cat ./robusta_krr/__init__.py

- name: Set version in code (Windows)
Expand Down Expand Up @@ -99,18 +101,22 @@ jobs:

- name: Zip the application (Unix)
if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' || matrix.os == 'macos-13'
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
cd dist
zip -r krr-${{ matrix.os }}-${{ github.ref_name }}.zip krr
mv krr-${{ matrix.os }}-${{ github.ref_name }}.zip ../
zip -r "krr-${{ matrix.os }}-$GITHUB_REF_NAME.zip" krr
mv "krr-${{ matrix.os }}-$GITHUB_REF_NAME.zip" ../
cd ..

- name: Zip the application (Windows)
if: matrix.os == 'windows-latest'
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
Set-Location -Path dist
Compress-Archive -Path krr -DestinationPath krr-${{ matrix.os }}-${{ github.ref_name }}.zip -Force
Move-Item -Path krr-${{ matrix.os }}-${{ github.ref_name }}.zip -Destination ..\
Compress-Archive -Path krr -DestinationPath "krr-${{ matrix.os }}-$($env:GITHUB_REF_NAME).zip" -Force
Move-Item -Path "krr-${{ matrix.os }}-$($env:GITHUB_REF_NAME).zip" -Destination ..\
Set-Location -Path ..

- name: Upload Release Asset
Expand Down Expand Up @@ -164,7 +170,9 @@ jobs:
name: krr-macos-latest-${{ github.ref_name }}
- name: Calculate hash
id: calc-hash
run: echo "::set-output name=MAC_BUILD_HASH::$(sha256sum krr-macos-latest-${{ github.ref_name }}.zip | awk '{print $1}')"
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
run: echo "::set-output name=MAC_BUILD_HASH::$(sha256sum "krr-macos-latest-$GITHUB_REF_NAME.zip" | awk '{print $1}')"
Comment thread
moshemorad marked this conversation as resolved.

# Define Linux hash job
linux-hash:
Expand All @@ -182,7 +190,9 @@ jobs:
name: krr-ubuntu-latest-${{ github.ref_name }}
- name: Calculate hash
id: calc-hash
run: echo "::set-output name=LINUX_BUILD_HASH::$(sha256sum krr-ubuntu-latest-${{ github.ref_name }}.zip | awk '{print $1}')"
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
run: echo "::set-output name=LINUX_BUILD_HASH::$(sha256sum "krr-ubuntu-latest-$GITHUB_REF_NAME.zip" | awk '{print $1}')"

# Define job to update homebrew formula
update-formula:
Expand All @@ -195,10 +205,14 @@ jobs:
repository: robusta-dev/homebrew-krr
token: ${{ secrets.MULTIREPO_GITHUB_TOKEN }}
- name: Update krr.rb formula
env:
MAC_BUILD_HASH_IN: ${{ needs.mac-hash.outputs.MAC_BUILD_HASH }}
LINUX_BUILD_HASH_IN: ${{ needs.linux-hash.outputs.LINUX_BUILD_HASH }}
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
MAC_BUILD_HASH=${{ needs.mac-hash.outputs.MAC_BUILD_HASH }}
LINUX_BUILD_HASH=${{ needs.linux-hash.outputs.LINUX_BUILD_HASH }}
TAG_NAME=${{ github.ref_name }}
MAC_BUILD_HASH="$MAC_BUILD_HASH_IN"
LINUX_BUILD_HASH="$LINUX_BUILD_HASH_IN"
TAG_NAME="$GITHUB_REF_NAME"
Comment thread
moshemorad marked this conversation as resolved.
awk 'NR==6{$0=" url \"https://github.com/robusta-dev/krr/releases/download/'"$TAG_NAME"'/krr-macos-latest-'"$TAG_NAME"'.zip\""}1' ./Formula/krr.rb > temp && mv temp ./Formula/krr.rb
awk 'NR==7{$0=" sha256 \"'$MAC_BUILD_HASH'\""}1' ./Formula/krr.rb > temp && mv temp ./Formula/krr.rb
awk 'NR==9{$0=" url \"https://github.com/robusta-dev/krr/releases/download/'"$TAG_NAME"'/krr-ubuntu-latest-'"$TAG_NAME"'.zip\""}1' ./Formula/krr.rb > temp && mv temp ./Formula/krr.rb
Expand Down
Loading