-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: implement update homebrew formula job
- Loading branch information
Showing
2 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
2 changes: 1 addition & 1 deletion
2
.github/workflows/rust_binaries_release.yml → .github/workflows/release.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Rust binaries release | ||
name: Release | ||
|
||
on: | ||
push: | ||
|