Skip to content

Commit

Permalink
Update build-on-release.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
aantn committed Jun 10, 2024
1 parent 0869067 commit 06c3946
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/build-on-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
# We build on an older Ubuntu as pyinstaller binaries are forward-compatible not backwards-compatible
# See https://pyinstaller.org/en/stable/usage.html?highlight=glibc#making-gnu-linux-apps-forward-compatible:~:text=The%20solution%20is%20to%20always%20build%20your%20app%20on%20the%20oldest%20version%20of%20GNU/Linux%20you%20mean%20to%20support.%20It%20should%20continue%20to%20work%20with%20the%20libc%20found%20on%20newer%20versions.
# TODO: for similar reasons, we may want to build on older Windows/MacOS versions as well
os: [ubuntu-20.04, windows-latest, macos-latest]

runs-on: ${{ matrix.os }}

Expand All @@ -26,13 +29,13 @@ jobs:
pip install -r requirements.txt
pip install pyinstaller
- name: Install dependancies (Linux)
if: matrix.os == 'ubuntu-latest'
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get install -y binutils
- name: Update package version (Linux)
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-20.04'
run: sed -i 's/__version__ = .*/__version__ = "${{ github.ref_name }}"/g' holmes/__init__.py

# mac has BSD style sed command where you specify -i '' and not just -i
Expand All @@ -55,7 +58,7 @@ jobs:
ls dist
- name: Zip the application (Unix)
if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest'
if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-20.04'
run: |
cd dist
zip -r holmes-${{ matrix.os }}-${{ github.ref_name }}.zip holmes
Expand Down Expand Up @@ -88,7 +91,7 @@ jobs:

check-latest:
needs: build
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
outputs:
IS_LATEST: ${{ steps.check-latest.outputs.release == github.ref_name }}
steps:
Expand Down Expand Up @@ -130,10 +133,10 @@ jobs:
- name: Download Linux artifact
uses: actions/download-artifact@v2
with:
name: holmes-ubuntu-latest-${{ github.ref_name }}
name: holmes-ubuntu-20.04-${{ github.ref_name }}
- name: Calculate hash
id: calc-hash
run: echo "::set-output name=LINUX_BUILD_HASH::$(sha256sum holmes-$-ubuntu-latest-${{ github.ref_name }}.zip | awk '{print $1}')"
run: echo "::set-output name=LINUX_BUILD_HASH::$(sha256sum holmes-$-ubuntu-20.04-${{ github.ref_name }}.zip | awk '{print $1}')"

# TODO: update homebrew formula
update-formula:
Expand All @@ -152,7 +155,7 @@ jobs:
TAG_NAME=${{ github.ref_name }}
awk 'NR==6{$0=" url \"https://github.com/robusta-dev/holmesgpt/releases/download/'"$TAG_NAME"'/holmes-macos-latest-'"$TAG_NAME"'.zip\""}1' ./Formula/holmesgpt.rb > temp && mv temp ./Formula/holmesgpt.rb
awk 'NR==7{$0=" sha256 \"'$MAC_BUILD_HASH'\""}1' ./Formula/holmesgpt.rb > temp && mv temp ./Formula/holmesgpt.rb
awk 'NR==9{$0=" url \"https://github.com/robusta-dev/holmesgpt/releases/download/'"$TAG_NAME"'/holmes-ubuntu-latest-'"$TAG_NAME"'.zip\""}1' ./Formula/holmesgpt.rb > temp && mv temp ./Formula/holmesgpt.rb
awk 'NR==9{$0=" url \"https://github.com/robusta-dev/holmesgpt/releases/download/'"$TAG_NAME"'/holmes-ubuntu-20.04-'"$TAG_NAME"'.zip\""}1' ./Formula/holmesgpt.rb > temp && mv temp ./Formula/holmesgpt.rb
awk 'NR==10{$0=" sha256 \"'$LINUX_BUILD_HASH'\""}1' ./Formula/holmesgpt.rb > temp && mv temp ./Formula/holmesgpt.rb
- name: Commit and push changes
run: |
Expand Down

0 comments on commit 06c3946

Please sign in to comment.