diff --git a/.github/workflows/fb-test.yml b/.github/workflows/fb-test.yml new file mode 100644 index 000000000..cb9e52f89 --- /dev/null +++ b/.github/workflows/fb-test.yml @@ -0,0 +1,76 @@ +name: FB Test + +on: + push: + branches: + - ci/homebrew-formula-generate + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + steps: + - name: Set matrix output + uses: cloudposse/github-action-matrix-outputs-write@v1 + id: out + with: + matrix-step-name: build-result + matrix-key: ${{ matrix.os }} + outputs: |- + releaseRequire: true + version: 0.3.0 + + trigger_brew_update: + needs: build + runs-on: ubuntu-latest + steps: + - id: get-matrix-outputs + uses: cloudposse/github-action-matrix-outputs-read@v1 + with: + matrix-step-name: build-result + - name: Debug + run: echo ${{ steps.get-matrix-outputs.outputs.result }} + - name: Create GitHub App Token + uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.GH_APP_ID }} + private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: | + homebrew-tap + - name: Get GitHub App User ID + id: get-user-id + run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} + - name: Configure Git + run: | + git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' + git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com' + - name: Checkout homebrew-tap + uses: actions/checkout@v4 + with: + repository: ${{ github.repository_owner }}/homebrew-tap + token: ${{ steps.app-token.outputs.token }} + persist-credentials: false + - name: Update Formula + run: | + # Read the JSON array from the file + json_array='["ubuntu-latest", "macos-latest"]' + + for matrix_key in $(echo "${json_array}" | jq -r '.[]'); do + release_required=$(echo '${{ steps.get-matrix-outputs.outputs.result }}' | jq -r '.releaseRequired["'"${matrix_key}"'"]') + version=$(echo '${{ steps.get-matrix-outputs.outputs.result }}' | jq -r '.version["'"${matrix_key}"'"]') + + if [ "${release_required}" == "true" ]; then + echo "Release is required for ${matrix_key}. Version: ${version}" + else + echo "Release is not required for ${matrix_key}." + fi + done + + echo "Updating formula" + cat generate-formula.sh diff --git a/.github/workflows/rust_binaries_release.yml b/.github/workflows/release.yml similarity index 99% rename from .github/workflows/rust_binaries_release.yml rename to .github/workflows/release.yml index f5192e111..78e05ee65 100644 --- a/.github/workflows/rust_binaries_release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Rust binaries release +name: Release on: push: