[Backport v4.x] backport full node streaming to v4.x branch (#1270) #84
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: Release | |
# This workflow helps with creating releases. | |
# This job will only be triggered when a protocol release tag is pushed | |
on: # yamllint disable-line rule:truthy | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- "protocol/v[0-9]+.[0-9]+.[0-9]+" # e.g.: protocol/v1.0.1 | |
- "protocol/v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" # e.g.: protocol/v1.0.1-rc1 | |
- "protocol/v[0-9]+.[0-9]+.[0-9]+-dev[0-9]+" # e.g.: protocol/v1.0.1-dev1 | |
jobs: | |
protocol-release: | |
name: Create Release | |
permissions: | |
contents: write | |
defaults: | |
run: | |
working-directory: ./protocol | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: set tag env | |
run: echo "VERSION=${GITHUB_REF#refs/tags/protocol/}" >> $GITHUB_ENV | |
- name: install go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.21' | |
check-latest: true | |
- name: Create Directory | |
run: mkdir ./build | |
- name: Build Reproducible Linux Binaries | |
run: make distclean build-reproducible | |
- name: Rename Binaries | |
run: | | |
mv ./build/dydxprotocold:linux-arm64 ./build/dydxprotocold-${{ env.VERSION }}-linux-arm64 | |
mv ./build/dydxprotocold:linux-amd64 ./build/dydxprotocold-${{ env.VERSION }}-linux-amd64 | |
- name: Compress binaries | |
run: | | |
tar -cvzf dydxprotocold-${{ env.VERSION }}-linux-arm64.tar.gz \ | |
./build/dydxprotocold-${{ env.VERSION }}-linux-arm64 | |
tar -cvzf dydxprotocold-${{ env.VERSION }}-linux-amd64.tar.gz \ | |
./build/dydxprotocold-${{ env.VERSION }}-linux-amd64 | |
- name: Create 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 }} | |
# TODO(DEC-1743): add more helpful release notes and change logs | |
body: Release ${{ env.VERSION }} | |
draft: true | |
prerelease: false | |
- name: Upload linux-amd64 tar.gz | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: protocol/dydxprotocold-${{ env.VERSION }}-linux-amd64.tar.gz | |
asset_name: dydxprotocold-${{ env.VERSION }}-linux-amd64.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload linux-arm64 tar.gz | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: protocol/dydxprotocold-${{ env.VERSION }}-linux-arm64.tar.gz | |
asset_name: dydxprotocold-${{ env.VERSION }}-linux-arm64.tar.gz | |
asset_content_type: application/gzip | |
# TODO(DEC-1743): add build report and binary check sums | |
v4-proto-py-release: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./v4-proto-py | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install buf | |
run: | | |
BIN="/usr/local/bin" && \ | |
VERSION="1.26.1" && \ | |
curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-Linux-x86_64" -o "${BIN}/buf" && \ | |
chmod +x "${BIN}/buf" | |
- name: Install Requirements | |
run: pip install -r requirements-publish.txt | |
- name: Generate v4-proto-py | |
working-directory: ./ # Move to parent folder | |
run: make v4-proto-py-gen | |
- name: Set Env from Tag (remove 'v' prefix) | |
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/protocol/v} | tr '-' '.')" >> $GITHUB_ENV | |
- name: Update version in setup.py | |
run: echo $VERSION; sed -i "s/0.0.0/$VERSION/g" setup.py | |
- name: Build package and source tarball | |
run: | | |
pip3 wheel --no-deps -w dist . | |
python3 setup.py sdist -d dist | |
- name: Publish to PyPI | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
twine upload -r pypi dist/* | |
v4-proto-js-release: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./v4-proto-js | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org | |
cache: "npm" | |
cache-dependency-path: '**/package-lock.json' | |
- name: Install buf | |
run: | | |
BIN="/usr/local/bin" && \ | |
VERSION="1.26.1" && \ | |
curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-Linux-x86_64" -o "${BIN}/buf" && \ | |
chmod +x "${BIN}/buf" | |
- name: Set Env from Tag to follow semver | |
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/protocol/v} | sed -r 's/(.*-[[:alpha:]]+)([[:digit:]]+)/\1.\2/')" >> $GITHUB_ENV | |
- name: Update version in package.json | |
run: echo $VERSION; sed -i "s/0.0.0/$VERSION/g" package.json | |
- name: Install | |
run: npm i | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_READ }} | |
- name: Transpile | |
run: npm run transpile | |
- name: Publish | |
run: ./scripts/publish-if-not-exists.sh | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_WRITE }} |