chore(main): release flagd family (#148) #68
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: Run Release Please | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| release-please: | |
| name: Release Please (${{ matrix.name }}) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: flagd family | |
| config_file: release-please-config.json | |
| manifest_file: .release-please-manifest.json | |
| publish_order: '["crates/flagd-evaluation-engine","crates/ofrep","crates/flagd"]' | |
| submodules: recursive | |
| install_protobuf: true | |
| - name: independent providers | |
| config_file: release-please-independent-providers-config.json | |
| manifest_file: .release-please-manifest-independent-providers.json | |
| publish_order: '["crates/env-var","crates/flagsmith","crates/flipt"]' | |
| submodules: false | |
| install_protobuf: false | |
| steps: | |
| - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 | |
| id: release | |
| with: | |
| token: ${{ secrets.RELEASE_PLEASE_ACTION_TOKEN }} | |
| config-file: ${{ matrix.config_file }} | |
| manifest-file: ${{ matrix.manifest_file }} | |
| - name: Dump Release Please Output | |
| env: | |
| RELEASE_PLEASE_OUTPUT: ${{ toJson(steps.release.outputs) }} | |
| run: | | |
| echo "$RELEASE_PLEASE_OUTPUT" | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 | |
| if: ${{ fromJSON(steps.release.outputs.releases_created || 'false') }} | |
| with: | |
| submodules: ${{ matrix.submodules }} | |
| - name: Install protobuf compiler | |
| if: ${{ fromJSON(steps.release.outputs.releases_created || 'false') && matrix.install_protobuf }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y protobuf-compiler | |
| - name: Install Rust | |
| if: ${{ fromJSON(steps.release.outputs.releases_created || 'false') }} | |
| run: rustup update --no-self-update stable && rustup default stable | |
| - name: Setup cache | |
| if: ${{ fromJSON(steps.release.outputs.releases_created || 'false') }} | |
| uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 | |
| - name: Publish released crates | |
| if: ${{ fromJSON(steps.release.outputs.releases_created || 'false') }} | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| PATHS_RELEASED: ${{ steps.release.outputs.paths_released }} | |
| PUBLISH_ORDER: ${{ matrix.publish_order }} | |
| run: | | |
| publish_if_released() { | |
| crate_path="$1" | |
| if ! echo "$PATHS_RELEASED" | jq -e --arg path "$crate_path" 'index($path)' >/dev/null; then | |
| return 0 | |
| fi | |
| for attempt in 1 2 3 4 5; do | |
| if cargo publish --manifest-path "$crate_path/Cargo.toml"; then | |
| return 0 | |
| fi | |
| if [ "$attempt" -eq 5 ]; then | |
| return 1 | |
| fi | |
| sleep 30 | |
| done | |
| } | |
| while IFS= read -r crate_path; do | |
| publish_if_released "$crate_path" | |
| done < <(jq -r '.[]' <<< "$PUBLISH_ORDER") |