coot: remove gemmi #965
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
name: Upload bottles | |
on: | |
push: | |
branches: [develop] | |
jobs: | |
upload-bottles: | |
runs-on: ubuntu-22.04 | |
env: | |
HOMEBREW_FORCE_HOMEBREW_ON_LINUX: 1 | |
HOMEBREW_GITHUB_PACKAGES_USER: LinuxbrewTestBot | |
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{secrets.HOMEBREW_GITHUB_PACKAGES_TOKEN}} | |
HOMEBREW_NO_ANALYTICS: 1 | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
steps: | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: 100 | |
- name: Update Homebrew | |
run: | | |
echo "/home/linuxbrew/.linuxbrew/bin" >> "$GITHUB_PATH" | |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
brew update | |
- name: Upload bottles | |
shell: bash | |
env: | |
COMMIT_MESSAGE: ${{github.event.head_commit.message}} | |
run: | | |
#!/bin/bash | |
set -eu | |
echo sha1='${{github.event.head_commit.id}}' | |
echo "$COMMIT_MESSAGE" | |
# pr="$(echo "$COMMIT_MESSAGE" | sed 's/^.*#\([0-9]*\).*/\1/;q')" | |
pr="${COMMIT_MESSAGE##*#}" | |
pr="${pr%%[^0-9]*}" | |
mkdir -p "$(dirname "$(brew --repo ${{github.repository}})")" | |
cp -a "$GITHUB_WORKSPACE" "$(brew --repo ${{github.repository}})" | |
rm -rf -- .git * | |
git -C "$(brew --repo ${{github.repository}})" fetch origin "pull/$pr/head:pr-head" | |
sha1="$(git -C "$(brew --repo ${{github.repository}})" rev-parse pr-head)" | |
echo pr="$pr" sha1="$sha1" | |
if [[ -n "$(curl -fs -H 'Accept: application/vnd.github.antiope-preview+json' "https://api.github.com/repos/${{github.repository}}/pulls/$pr" \ | |
| jq '.labels[] | select(.name == "ci-skip-upload")')" ]]; then | |
echo Skipping upload... | |
else | |
run_id="$(curl -fs -H 'Accept: application/vnd.github.antiope-preview+json' https://api.github.com/repos/${{github.repository}}/actions/workflows/build-bottles.yml/runs \ | |
| jq ".workflow_runs[] | select(.head_sha == \"$sha1\").id")" | |
# artifacts[-1] is "all-bottles" | |
artifact_id="$(curl -fs -H 'Accept: application/vnd.github.antiope-preview+json' "https://api.github.com/repos/${{github.repository}}/actions/runs/$run_id/artifacts" \ | |
| jq '.artifacts[-1].id')" | |
echo run_id="$run_id" artifact_id="$artifact_id" | |
curl -fL -o bottles.zip "https://${{secrets.HOMEBREW_GITHUB_API_TOKEN}}@api.github.com/repos/${{github.repository}}/actions/artifacts/$artifact_id/zip" | |
file bottles.zip | |
unzip bottles.zip | |
git -C "$(brew --repo ${{github.repository}})" status | |
git config --global user.name "Brewsci" | |
git config --global user.email "[email protected]" | |
which -a skopeo | |
skopeo --version | |
brew pr-upload --root-url=https://ghcr.io/v2/brewsci/bio | |
fi | |
cd "$(brew --repo ${{github.repository}})" | |
git branch -f "pr$pr" | |
git fetch origin master | |
git checkout master | |
git reset --hard origin/master | |
git merge -m "Merge pull request #$pr" "pr$pr" | |
git status | |
if ! git push "https://LinuxbrewTestBot:${{secrets.HOMEBREW_GITHUB_API_TOKEN}}@github.com/${{github.repository}}" master:develop master; then | |
git push --force origin "pr$pr" | |
mkdir ~/bin | |
curl -fsL https://github.com/github/hub/releases/download/v2.14.1/hub-linux-amd64-2.14.1.tgz \ | |
| tar xzO hub-linux-amd64-2.14.1/bin/hub >~/bin/hub | |
chmod +x ~/bin/hub | |
git reset --hard origin/master | |
GITHUB_TOKEN='${{secrets.HOMEBREW_GITHUB_API_TOKEN}}' ~/bin/hub pull-request -l bottles -b master -h "pr$pr" -m "Bottles for PR $pr" --no-edit | |
fi |