Repository navigation
release: v0.15.1 #297
Workflow file for this run
This file contains hidden or 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: Publish ephemeral validator packages and crates | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| release: | |
| types: [published] | |
| push: | |
| branches: | |
| - 'release/v*' | |
| workflow_dispatch: | |
| inputs: | |
| release_version: | |
| description: 'The release version' | |
| required: true | |
| default: 'v0.1.0' | |
| jobs: | |
| validate-release-branch: | |
| name: Validate release branch | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout this magicblock-validator | |
| uses: actions/checkout@v4 | |
| with: | |
| path: magicblock-validator | |
| - name: Check versions are aligned | |
| shell: bash | |
| run: | | |
| cd magicblock-validator/.github && ./version-align.sh --check | |
| publish-binaries: | |
| name: Publish Binaries | |
| if: github.event_name != 'push' | |
| runs-on: ${{ matrix.build.OS }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build: | |
| - { | |
| NAME: linux-x64-glibc, | |
| OS: ubuntu-latest, | |
| TOOLCHAIN: stable, | |
| TARGET: x86_64-unknown-linux-gnu | |
| } | |
| - { | |
| NAME: linux-arm64-glibc, | |
| OS: arm64, | |
| TOOLCHAIN: stable, | |
| TARGET: aarch64-unknown-linux-gnu | |
| } | |
| - { | |
| NAME: darwin-x64, | |
| OS: macos-15-intel, | |
| TOOLCHAIN: stable, | |
| TARGET: x86_64-apple-darwin | |
| } | |
| - { | |
| NAME: darwin-arm64, | |
| OS: macos-latest, | |
| TOOLCHAIN: stable, | |
| TARGET: aarch64-apple-darwin | |
| } | |
| steps: | |
| - name: Checkout this magicblock-validator | |
| uses: actions/checkout@v4 | |
| with: | |
| path: magicblock-validator | |
| - uses: ./magicblock-validator/.github/actions/setup-build-env | |
| with: | |
| build_cache_key_name: "magicblock-validator-ci-publish-v000" | |
| rust_toolchain_release: "1.94.1" | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install target | |
| shell: bash | |
| run: rustup target add ${{ matrix.build.TARGET }} | |
| - name: Set DRY_RUN by default | |
| shell: bash | |
| run: echo "DRY_RUN=true" >> $GITHUB_ENV | |
| - name: Unset DRY_RUN for releases | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| shell: bash | |
| run: echo "DRY_RUN=false" >> $GITHUB_ENV | |
| - name: Set release version | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| echo "RELEASE_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | |
| elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "RELEASE_VERSION=${{ github.event.inputs.release_version }}" >> $GITHUB_ENV | |
| elif [[ "${{ github.ref }}" == refs/heads/release/v* ]]; then | |
| echo "RELEASE_VERSION=$(echo ${{ github.ref }} | sed 's|refs/heads/release/||')" >> $GITHUB_ENV | |
| else | |
| echo "RELEASE_VERSION=v0.0.0-dev" >> $GITHUB_ENV | |
| fi | |
| - name: Set up GCC | |
| if: matrix.build.OS == 'ubuntu-latest' | |
| uses: egor-tensin/setup-gcc@v1.3 | |
| with: | |
| version: latest | |
| - name: Install additional build dependencies | |
| if: startsWith(matrix.build.OS, 'ubuntu') | |
| shell: bash | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake pkg-config libssl-dev | |
| - name: Install macOS dependencies | |
| if: startsWith(matrix.build.OS, 'macos') | |
| shell: bash | |
| run: | | |
| brew install protobuf llvm | |
| # Add LLVM to PATH for libclang.dylib - base on target architecture | |
| if [ "${{ matrix.build.TARGET }}" = "aarch64-apple-darwin" ]; then | |
| echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH | |
| echo "LIBCLANG_PATH=/opt/homebrew/opt/llvm/lib" >> $GITHUB_ENV | |
| else | |
| echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH | |
| echo "LIBCLANG_PATH=/usr/local/opt/llvm/lib" >> $GITHUB_ENV | |
| fi | |
| - name: Set macOS minimum version | |
| if: startsWith(matrix.build.OS, 'macos') | |
| shell: bash | |
| run: | | |
| echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV | |
| echo "CFLAGS=-mmacosx-version-min=11.0" >> $GITHUB_ENV | |
| echo "CXXFLAGS=-mmacosx-version-min=11.0" >> $GITHUB_ENV | |
| echo "LDFLAGS=-mmacosx-version-min=11.0" >> $GITHUB_ENV | |
| - name: Force vendored OpenSSL for macOS | |
| if: startsWith(matrix.build.OS, 'macos') | |
| shell: bash | |
| run: | | |
| echo "OPENSSL_STATIC=1" >> $GITHUB_ENV | |
| echo "OPENSSL_VENDORED=1" >> $GITHUB_ENV | |
| - name: Build (linux/macos) | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: build | |
| args: --manifest-path=magicblock-validator/Cargo.toml --release --locked --features tui --target ${{ matrix.build.TARGET }} | |
| - name: Check versions are aligned | |
| shell: bash | |
| run: | | |
| cd magicblock-validator/.github && ./version-align.sh --check | |
| - name: Build the NPM package | |
| shell: bash | |
| run: | | |
| cd magicblock-validator | |
| bin="ephemeral-validator" | |
| mv target/${{ matrix.build.TARGET }}/release/magicblock-validator target/${{ matrix.build.TARGET }}/release/${bin} | |
| node_os=$(echo "${{ matrix.build.NAME }}" | cut -d '-' -f1) | |
| export node_os | |
| node_arch=$(echo "${{ matrix.build.NAME }}" | cut -d '-' -f2) | |
| export node_arch | |
| export node_version="${{ env.RELEASE_VERSION }}" | |
| export node_pkg="${bin}-${node_os}-${node_arch}" | |
| echo "node_pkg=${node_pkg}" >> $GITHUB_ENV | |
| mkdir -p "${node_pkg}/bin" | |
| envsubst < .github/packages/npm-package/package.json.tmpl > "${node_pkg}/package.json" | |
| cat "${node_pkg}/package.json" | |
| echo "bin_name=${bin}" >> $GITHUB_ENV | |
| cp "target/${{ matrix.build.TARGET }}/release/${bin}" "${node_pkg}/bin" | |
| release_name="ephemeral-validator-${{ matrix.build.NAME }}" | |
| echo "release_name=${release_name}" >> $GITHUB_ENV | |
| mv "target/${{ matrix.build.TARGET }}/release/${bin}" "target/${{ matrix.build.TARGET }}/release/${release_name}" | |
| - name: Publish binary to GitHub release | |
| if: ${{ env.DRY_RUN == 'false' }} | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: magicblock-validator/target/${{ matrix.build.TARGET }}/release/${{ env.release_name }} | |
| overwrite: true | |
| tag: "${{ env.RELEASE_VERSION }}" | |
| release_name: "${{ env.RELEASE_VERSION }}" | |
| asset_name: "${{ env.release_name }}" | |
| - name: Publish the NPM package | |
| shell: bash | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| cd magicblock-validator | |
| echo "DRY_RUN=${{ env.DRY_RUN }}" | |
| cd ${{ env.node_pkg }} | |
| echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
| npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} | |
| if [ "${{ env.DRY_RUN }}" = "true" ]; then | |
| echo "Running npm publish in dry-run mode" | |
| npm publish --access public --dry-run | |
| else | |
| npm publish --access public | |
| fi | |
| publish-wrapper-npm-package: | |
| name: Publish wrapper NPM packages | |
| if: github.event_name != 'push' | |
| runs-on: ubuntu-latest | |
| needs: publish-binaries | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set DRY_RUN by default | |
| shell: bash | |
| run: echo "DRY_RUN=true" >> $GITHUB_ENV | |
| - name: Unset DRY_RUN for releases | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| shell: bash | |
| run: echo "DRY_RUN=false" >> $GITHUB_ENV | |
| - uses: ./.github/actions/setup-solana | |
| - name: Publish the NPM package | |
| shell: bash | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| cd .github/packages/npm-package | |
| npm install | |
| npm run build | |
| cd lib | |
| echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
| npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} | |
| if [ "${{ env.DRY_RUN }}" = "true" ]; then | |
| echo "Running npm publish in dry-run mode" | |
| npm publish --access public --dry-run | |
| else | |
| npm publish --access public | |
| fi | |
| - name: cargo publish | |
| working-directory: magicblock-magic-program-api/ | |
| run: | | |
| DRY_RUN_FLAG="" | |
| if [ "${DRY_RUN}" = "true" ]; then | |
| DRY_RUN_FLAG="--dry-run" | |
| fi | |
| if [ "${DRY_RUN}" = "true" ]; then | |
| NO_VERIFY_FLAG="--no-verify" | |
| fi | |
| cargo publish $DRY_RUN_FLAG --manifest-path=./Cargo.toml --token $CRATES_TOKEN $NO_VERIFY_FLAG | |
| env: | |
| CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} | |
| DRY_RUN: ${{ env.DRY_RUN }} |