Fix macOS runner version to 13 (#2) #9
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: Build and Release | |
on: | |
push: | |
tags: | |
- "*" | |
permissions: | |
contents: write | |
jobs: | |
build_linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: pip install -r ./build_configs/linux/requirements.txt | |
- name: Build with build.spec | |
run: | | |
export PYTHONHASHSEED=42 | |
export GITHUB_SHA_SHORT=${GITHUB_SHA::7} | |
export BUILD_FILE_NAME=staking_deposit-cli-${GITHUB_SHA_SHORT}-linux-amd64 | |
mkdir ${BUILD_FILE_NAME} | |
pyinstaller --distpath ./dist/${BUILD_FILE_NAME} ./build_configs/linux/build.spec | |
- name: Compress the file | |
id: compress_file | |
run: | | |
export GITHUB_SHA_SHORT=${GITHUB_SHA::7} | |
export BUILD_FILE_NAME=staking_deposit-cli-${GITHUB_SHA_SHORT}-linux-amd64 | |
tar -zcvf ${BUILD_FILE_NAME}.tar.gz ./dist/${BUILD_FILE_NAME} | |
mkdir -p ./build/linux | |
cp ${BUILD_FILE_NAME}.tar.gz ./build/linux | |
shasum_result=$(sha256sum ${BUILD_FILE_NAME}.tar.gz | head -c 64) | |
echo "shasum_result=${shasum_result}" >> $GITHUB_OUTPUT | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-linux | |
path: ./build/linux | |
outputs: | |
shasum_result: ${{ steps.compress_file.outputs.shasum_result }} | |
build_macos: | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: pip install -r ./build_configs/macos/requirements.txt | |
- name: Build with build.spec | |
run: | | |
export PYTHONHASHSEED=42 | |
export GITHUB_SHA_SHORT=${GITHUB_SHA::7} | |
export BUILD_FILE_NAME=staking_deposit-cli-${GITHUB_SHA_SHORT}-macos | |
mkdir ${BUILD_FILE_NAME} | |
pyinstaller --distpath ./dist/${BUILD_FILE_NAME} ./build_configs/macos/build.spec | |
- name: Compress the file | |
id: compress_file | |
run: | | |
export GITHUB_SHA_SHORT=${GITHUB_SHA::7} | |
export BUILD_FILE_NAME=staking_deposit-cli-${GITHUB_SHA_SHORT}-macos | |
tar -zcvf ${BUILD_FILE_NAME}.tar.gz ./dist/${BUILD_FILE_NAME} | |
mkdir -p ./build/macos | |
cp ${BUILD_FILE_NAME}.tar.gz ./build/macos | |
shasum_result=$(shasum -a 256 ${BUILD_FILE_NAME}.tar.gz | head -c 64) | |
echo "shasum_result=${shasum_result}" >> $GITHUB_OUTPUT | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-macos | |
path: ./build/macos | |
outputs: | |
shasum_result: ${{ steps.compress_file.outputs.shasum_result }} | |
build_windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: pip install -r ./build_configs/windows/requirements.txt | |
- name: Build with build.spec | |
run: | | |
$PYTHONHASHSEED = 42 | |
$GITHUB_SHA_SHORT = $env:GITHUB_SHA.Substring(0,7) | |
$BUILD_FILE_NAME = "staking_deposit-cli-" + $GITHUB_SHA_SHORT + "-windows-amd64" | |
mkdir $BUILD_FILE_NAME | |
$BUILD_FILE_NAME_PATH = ".\dist\" + $BUILD_FILE_NAME | |
pyinstaller --distpath $BUILD_FILE_NAME_PATH .\build_configs\windows\build.spec | |
- name: Compress the file | |
id: compress_file | |
run: | | |
$PYTHONHASHSEED = 42 | |
$GITHUB_SHA_SHORT = $env:GITHUB_SHA.Substring(0,7) | |
$BUILD_FILE_NAME = "staking_deposit-cli-" + $GITHUB_SHA_SHORT + "-windows-amd64" | |
$BUILD_FILE_NAME_PATH = ".\dist\" + $BUILD_FILE_NAME | |
$ZIP_FILE_NAME = $BUILD_FILE_NAME + ".zip" | |
Compress-Archive -Path $BUILD_FILE_NAME_PATH -DestinationPath $ZIP_FILE_NAME | |
mkdir .\build\windows | |
copy $ZIP_FILE_NAME .\build\windows | |
$SHA_RESULT = Get-FileHash $ZIP_FILE_NAME -Algorithm SHA256 | Select-Object -ExpandProperty Hash | |
echo "shasum_result=${SHA_RESULT}" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-windows | |
path: ./build/windows | |
outputs: | |
shasum_result: ${{ steps.compress_file.outputs.shasum_result }} | |
release: | |
needs: [build_linux, build_macos, build_windows] | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
sha_short: ${{ steps.set_sha_short.outputs.sha_short }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set sha_short | |
id: set_sha_short | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Set tag_name | |
id: set_tag_name | |
run: echo "tag_name=$(git describe --tags)" >> $GITHUB_OUTPUT | |
- 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 | |
body: | | |
### Release Artifacts | |
You can find the binary executable files under assets below. | |
| Platform | Compressed file | SHA256 Checksum | | |
| ------------- | ------------------------------------------------ | ---------------------------------------------------------------- | | |
| macOS amd64 | [staking_deposit-cli-${{ steps.set_sha_short.outputs.sha_short }}-macos.tar.gz](https://github.com/overprotocol/staking-deposit-cli/releases/download/${{ steps.set_tag_name.outputs.tag_name }}/staking_deposit-cli-${{ steps.set_sha_short.outputs.sha_short }}-macos.tar.gz) | ${{ needs.build_macos.outputs.shasum_result }} | | |
| Linux amd64 | [staking_deposit-cli-${{ steps.set_sha_short.outputs.sha_short }}-linux-amd64.tar.gz](https://github.com/overprotocol/staking-deposit-cli/releases/download/${{ steps.set_tag_name.outputs.tag_name }}/staking_deposit-cli-${{ steps.set_sha_short.outputs.sha_short }}-linux-amd64.tar.gz) | ${{ needs.build_linux.outputs.shasum_result }} | | |
| Windows amd64 | [staking_deposit-cli-${{ steps.set_sha_short.outputs.sha_short }}-windows-amd64.zip](https://github.com/overprotocol/staking-deposit-cli/releases/download/${{ steps.set_tag_name.outputs.tag_name }}/staking_deposit-cli-${{ steps.set_sha_short.outputs.sha_short }}-windows-amd64.zip) | ${{ needs.build_windows.outputs.shasum_result }} | | |
**Full Changelog**: https://github.com/overprotocol/staking-deposit-cli/commits/${{ steps.set_tag_name.outputs.tag_name }} | |
upload_assets: | |
needs: [release] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- platform: linux | |
file: staking_deposit-cli-${{ needs.release.outputs.sha_short }}-linux-amd64.tar.gz | |
- platform: macos | |
file: staking_deposit-cli-${{ needs.release.outputs.sha_short }}-macos.tar.gz | |
- platform: windows | |
file: staking_deposit-cli-${{ needs.release.outputs.sha_short }}-windows-amd64.zip | |
steps: | |
- name: Download build artifacts (${{ matrix.platform }}) | |
uses: actions/download-artifact@v2 | |
with: | |
name: build-${{ matrix.platform }} | |
path: ./build/${{ matrix.platform }} | |
- name: Upload Release Assets (${{ matrix.platform }}) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ./build/${{ matrix.platform }}/${{ matrix.file }} | |
asset_name: ${{ matrix.file }} | |
asset_content_type: application/octet-stream |