-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1688fda
Showing
17 changed files
with
3,664 additions
and
0 deletions.
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,24 @@ | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
indent_size = 4 | ||
indent_style = space | ||
trim_trailing_whitespace = false | ||
|
||
[*.yml] | ||
indent_size = 2 | ||
indent_style = space | ||
|
||
[*.rb] | ||
indent_size = 2 | ||
indent_style = space |
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,80 @@ | ||
tick="✓" | ||
|
||
step_log() { | ||
message=$1 | ||
printf "\n\033[90;1m==> \033[0m\033[37;1m%s\033[0m\n" "$message" | ||
} | ||
|
||
add_log() { | ||
mark=$1 | ||
subject=$2 | ||
message=$3 | ||
if [ "$mark" = "$tick" ]; then | ||
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message" | ||
else | ||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message" | ||
fi | ||
} | ||
|
||
step_log "Housekeeping" | ||
unset HOMEBREW_DISABLE_LOAD_FORMULA | ||
brew update-reset "$(brew --repository)" >/dev/null 2>&1 | ||
add_log "$tick" "Housekeeping" "Done" | ||
|
||
if [ "$PHP_VERSION" != "[email protected]" ]; then | ||
step_log "Sourcing latest formulae" | ||
sh .github/scripts/update.sh new "$PHP_VERSION" >/dev/null 2>&1 | ||
add_log "$tick" "Formulae" "Sourced" | ||
fi | ||
|
||
step_log "Checking label" | ||
package="${PHP_VERSION//@/:}" | ||
new_version=$(brew info Formula/"$PHP_VERSION".rb | grep "$PHP_VERSION" | head -n 1 | cut -d' ' -f3) | ||
existing_version=$(curl --user "$HOMEBREW_BINTRAY_USER":"$HOMEBREW_BINTRAY_KEY" -s https://api.bintray.com/packages/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO"/"$package" | sed -e 's/^.*"latest_version":"\([^"]*\)".*$/\1/') | ||
echo "existing label: $existing_version" | ||
echo "new label: $new_version" | ||
if [ "$new_version" != "$existing_version" ] || [[ "$existing_version" =~ ^8.* ]]; then | ||
add_log "$tick" "PHP $new_version" "New label found or nightly build" | ||
|
||
step_log "Adding tap $GITHUB_REPOSITORY" | ||
mkdir -p "$(brew --prefix)/Homebrew/Library/Taps/$HOMEBREW_BINTRAY_USER" | ||
ln -s "$PWD" "$(brew --prefix)/Homebrew/Library/Taps/$GITHUB_REPOSITORY" | ||
add_log "$tick" "$GITHUB_REPOSITORY" "Tap added to brewery" | ||
|
||
step_log "Filling the Bottle" | ||
brew test-bot "$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO"/"$PHP_VERSION" --root-url=https://dl.bintray.com/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO" --skip-setup --skip-homebrew | ||
LC_ALL=C find . -type f -name '*.json' -exec sed -i '' s~homebrew/bottles-php~"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO"~ {} + | ||
LC_ALL=C find . -type f -name '*.json' -exec sed -i '' s~bottles-php~php~ {} + | ||
LC_ALL=C find . -type f -name '*.json' -exec sed -i '' s~bottles~php~ {} + | ||
cat *.json | ||
add_log "$tick" "PHP $new_version" "Bottle filled" | ||
|
||
step_log "Adding label" | ||
curl \ | ||
--user "$HOMEBREW_BINTRAY_USER":"$HOMEBREW_BINTRAY_KEY" \ | ||
--header "Content-Type: application/json" \ | ||
--data " \ | ||
{\"name\": \"$package\", \ | ||
\"vcs_url\": \"$GITHUB_REPOSITORY\", \ | ||
\"licenses\": [\"MIT\"], \ | ||
\"public_download_numbers\": true, \ | ||
\"public_stats\": true \ | ||
}" \ | ||
https://api.bintray.com/packages/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO" >/dev/null 2>&1 || true | ||
add_log "$tick" "$package" "Bottle labeled" | ||
|
||
step_log "Stocking the new Bottle" | ||
git stash | ||
git pull -f https://"$HOMEBREW_BINTRAY_USER":"$GITHUB_TOKEN"@github.com/"$GITHUB_REPOSITORY".git HEAD:master | ||
git stash apply | ||
curl --user "$HOMEBREW_BINTRAY_USER":"$HOMEBREW_BINTRAY_KEY" -X DELETE https://api.bintray.com/packages/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO"/"$package"/versions/"$new_version" >/dev/null 2>&1 || true | ||
brew test-bot --ci-upload --tap="$GITHUB_REPOSITORY" --root-url=https://dl.bintray.com/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO" --bintray-org="$HOMEBREW_BINTRAY_USER" | ||
curl --user "$HOMEBREW_BINTRAY_USER":"$HOMEBREW_BINTRAY_KEY" -X POST https://api.bintray.com/content/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO"/"$package"/"$new_version"/publish >/dev/null 2>&1 || true | ||
add_log "$tick" "PHP $new_version" "Bottle added to stock" | ||
|
||
step_log "Updating inventory" | ||
git push -f https://"$HOMEBREW_BINTRAY_USER":"$GITHUB_TOKEN"@github.com/"$GITHUB_REPOSITORY".git HEAD:master --follow-tags | ||
add_log "$tick" "Inventory" "updated" | ||
else | ||
add_log "$tick" "PHP $new_version" "Bottle exists" | ||
fi |
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,10 @@ | ||
brew_old_url_prefix='https://raw.githubusercontent.com/eXolnet/homebrew-deprecated/master/Formula' | ||
brew_new_url_prefix='https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula' | ||
|
||
mkdir -p Formula | ||
if [ $1 = 'old' ]; then | ||
curl -o Formula/"$2".rb "$brew_old_url_prefix"/"$2".rb | ||
fi | ||
if [ $1 = 'new' ]; then | ||
curl -o Formula/"$2".rb "$brew_new_url_prefix"/"$2".rb | ||
fi |
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,63 @@ | ||
name: 'Update and Build Formulae' | ||
on: | ||
repository_dispatch: | ||
push: | ||
paths: | ||
- '**.rb' | ||
- '**.yml' | ||
- '**.sh' | ||
schedule: | ||
- cron: '0 0 * * *' | ||
jobs: | ||
supported: | ||
runs-on: macOS-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: | ||
- 'php' | ||
- '[email protected]' | ||
- '[email protected]' | ||
- '[email protected]' | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: build | ||
run: sh ./.github/scripts/build.sh | ||
env: | ||
GIT_URL: https://github.com/shivammathur/homebrew-php.git | ||
GITHUB_REPOSITORY: ${{ github.repository }} | ||
GITHUB_NAME: "Shivam Mathur" | ||
HOMEBREW_BINTRAY_USER: shivammathur | ||
HOMEBREW_BINTRAY_REPO: php | ||
HOMEBREW_BINTRAY_EMAIL: ${{ secrets.email }} | ||
HOMEBREW_BINTRAY_KEY: ${{ secrets.bintray_key }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PHP_VERSION: ${{ matrix.php-version }} | ||
GITHUB_ACTIONS: true | ||
continue-on-error: true | ||
deprecated: | ||
needs: supported | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: | ||
- '[email protected]' | ||
- '[email protected]' | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Fetch | ||
run: sh .github/scripts/update.sh old ${{ matrix.php-version }} | ||
- name: Commit files | ||
run: | | ||
git config --local user.email "${{ secrets.email }}" | ||
git config --local user.name "Shivam Mathur" | ||
if [[ `git status --porcelain` ]]; then | ||
git stash | ||
git pull -f https://"$HOMEBREW_BINTRAY_USER":"$GITHUB_TOKEN"@github.com/"$GITHUB_REPOSITORY".git HEAD:master | ||
git stash apply | ||
git add ./Formula/${{ matrix.php-version }}.rb | ||
git commit -m "Fetch latest Formula for ${{ matrix.php-version }}" | ||
git push -f https://"$HOMEBREW_BINTRAY_USER":"$GITHUB_TOKEN"@github.com/"$GITHUB_REPOSITORY".git HEAD:master --follow-tags | ||
fi | ||
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 @@ | ||
/.idea |
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 @@ | ||
../Formula/php.rb |
Oops, something went wrong.