Skip to content

Commit

Permalink
Merge pull request #281 from Shopify/github-actions-github-pages
Browse files Browse the repository at this point in the history
Github actions will now build debian packages and github pages on master push
  • Loading branch information
shuhaowu authored Apr 30, 2021
2 parents 588a932 + eb78d77 commit f0e9ad6
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 116 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -xe

sudo apt-get update
sudo apt-get install -y make

# We set this here, so it's the same between the copydb and sharding debian
# package.
DATETIME=$(date -u +%Y%m%d%H%M%S)

git status

make copydb-deb DATETIME=${DATETIME}
make sharding-deb DATETIME=${DATETIME}

cd build
sha256sum *.deb > ghostferry-$GITHUB_SHA.sha256sum

set +x

echo "Debian package built successfully as follows:"
ls -l ghostferry*

echo "sha256sum:"
cat ghostferry-$GITHUB_SHA.sha256sum

# Make sure the we didn't release a dirty build by accident
if ls | grep -q dirty; then
echo "ERROR: source directory is not clean! refused to release. showing git status below:"
git status
exit 1
fi
11 changes: 8 additions & 3 deletions .travisci/build-docs.sh → .github/workflows/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ cd docs
make html

cd build
git clone --depth 1 https://github.com/$TRAVIS_REPO_SLUG -b gh-pages ghostferry-pages
cp -ar html/. ghostferry-pages/$TRAVIS_BRANCH
git clone --depth 1 https://github.com/Shopify/ghostferry.git -b gh-pages ghostferry-pages
current_branch=${GITHUB_REF#refs/heads/}
cp -ar html/. ghostferry-pages/${current_branch}
cd ghostferry-pages

echo "<html>" > index.html
Expand All @@ -27,4 +28,8 @@ echo " </ul>" >> index.html
echo " </body>" >> index.html
echo "</html>" >> index.html

rm -rf .git
git status

cd ../../..
ls -la docs/build/ghostferry-pages
rm .git -rf
23 changes: 23 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Documentation on github pages

on:
push:
branches:
- master

jobs:
github-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Build documentations
run: .github/workflows/build-docs.sh


- name: Deploy github pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/ghostferry-pages

25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Package and release on Github

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Building Ghostferry
run: .github/workflows/build-deb.sh

- name: Releasing Ghostferry to Github
run: gh release create --target ${GITHUB_REF#refs/heads/} -p release-${GITHUB_SHA::8} build/ghostferry*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67 changes: 0 additions & 67 deletions .travis.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .travisci/build-debs.sh

This file was deleted.

12 changes: 0 additions & 12 deletions .travisci/deploy-packagecloud.sh

This file was deleted.

27 changes: 0 additions & 27 deletions .travisci/start-mysql.sh

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Variables to be built into the binary
VERSION := 1.1.0
DATETIME := $(shell date -u +%Y%m%d%H%M%S)
DATETIME ?= $(shell date -u +%Y%m%d%H%M%S) # This variable can be overwritten by the caller

ifndef IGNORE_DIRTY_TREE
DIRTY_TREE := $(shell git diff-index --quiet HEAD -- || echo '+dirty')
Expand Down

0 comments on commit f0e9ad6

Please sign in to comment.