Push to formulae.brew.sh with GitHub Actions (#37123)

Update formulae.brew.sh with GitHub Actions (and remove Travis CI). This removes the need for Travis CI for pushing changes to formulae.brew.sh and uses GitHub Actions instead.
master
Mike McQuaid 2019-02-21 12:32:23 +00:00 committed by GitHub
parent d38e4b445e
commit 10bc77109a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 55 deletions

View File

@ -6,5 +6,5 @@ workflow "Push" {
action "Generate formulae.brew.sh" {
uses = "docker://linuxbrew/brew"
runs = ".github/main.workflow.sh"
secrets = ["GITHUB_TOKEN"]
secrets = ["ANALYTICS_JSON_KEY", "FORMULAE_DEPLOY_KEY"]
}

View File

@ -2,32 +2,51 @@
set -e
# take ownership as current user (in case it's linuxbrew)
sudo mkdir ~/.cache
sudo chown -R $USER . ~/.cache
# silence bundler complaining about being root
mkdir ~/.bundle
echo 'BUNDLE_SILENCE_ROOT_WARNING: "1"' > ~/.bundle/config
# configure git
git config --global user.name "BrewTestBot"
git config --global user.email "homebrew-test-bot@lists.sfconservancy.org"
# create stubs so build dependencies aren't incorrectly flagged as missing
for i in python svn unzip xz
do
sudo touch /usr/bin/$i
sudo chmod +x /usr/bin/$i
touch /usr/bin/$i
chmod +x /usr/bin/$i
done
# tap Homebrew/homebrew-core instead of Linuxbrew's
rm -rf "$(brew --repo homebrew/core)"
# setup Homebrew/homebrew-core instead of Linuxbrew's
CORE_DIR="$(brew --repo homebrew/core)"
mkdir -p "$CORE_DIR"
rm -rf "$CORE_DIR"
ln -s "$PWD" "$CORE_DIR"
# setup Homebrew environment
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_FORCE_HOMEBREW_ON_LINUX=1
export PATH="$(brew --repo)/Library/Homebrew/vendor/portable-ruby/current/bin:$PATH"
brew tap homebrew/core
# clone formulae.brew.sh with token so we can push back
git clone https://$GITHUB_TOKEN@github.com/Homebrew/formulae.brew.sh
# TODO: setup/decrypt analytics JSON
#openssl aes-256-cbc -K $encrypted_973277d8afbb_key -iv $encrypted_973277d8afbb_iv -in formulae.brew.sh/.homebrew_analytics.json.enc -out formulae.brew.sh/.homebrew_analytics.json -d
# setup SSH
mkdir ~/.ssh
chmod 700 ~/.ssh
echo "$FORMULAE_DEPLOY_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
git config --global core.sshCommand "ssh -i ~/.ssh/id_ed25519 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
# clone formulae.brew.sh with SSH so we can push back
git clone git@github.com:Homebrew/formulae.brew.sh
cd formulae.brew.sh
# setup analytics
echo "$ANALYTICS_JSON_KEY" > ~/.homebrew_analytics.json
unset HOMEBREW_NO_ANALYTICS
# run rake (without a rake binary)
ruby -e "load Gem.bin_path('rake', 'rake')"
# commit and push generated files
git commit -m '_data: update from Homebrew/core push' _data/
git push

View File

@ -1,41 +0,0 @@
language: c
os: linux
compiler: gcc
sudo: false
deploy:
local-dir: formulae.brew.sh
repo: Homebrew/formulae.brew.sh
target-branch: master
verbose: true
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN
keep-history: true
on:
all_branches: true
before_install:
- HOMEBREW_REPOSITORY="$HOME/Homebrew"
- export PATH="$HOMEBREW_REPOSITORY/bin:$PATH"
- export HOMEBREW_FORCE_HOMEBREW_ORG=1
- export HOMEBREW_BOTTLE_DOMAIN=https://homebrew.bintray.com
# umask 022 fixes Linux `brew tests` failures
- umask 022
- chmod 644 Formula/*.rb
- rm -rf $HOMEBREW_REPOSITORY
- travis_retry git clone --depth=1 https://github.com/Homebrew/brew "$HOMEBREW_REPOSITORY"
- HOMEBREW_TAP_DIR="$(brew --repo "$TRAVIS_REPO_SLUG")"
- mkdir -p "$HOMEBREW_TAP_DIR"
- rm -rf "$HOMEBREW_TAP_DIR"
- ln -s "$PWD" "$HOMEBREW_TAP_DIR"
# trigger vendored ruby installation
- brew help
before_script:
- travis_retry git clone https://$GITHUB_TOKEN@github.com/Homebrew/formulae.brew.sh
- openssl aes-256-cbc -K $encrypted_973277d8afbb_key -iv $encrypted_973277d8afbb_iv -in formulae.brew.sh/.homebrew_analytics.json.enc -out formulae.brew.sh/.homebrew_analytics.json -d
script:
- cd formulae.brew.sh && rake