Skip to content

Commit

Permalink
Merge pull request #2 from GoLinks/mysql-5.6
Browse files Browse the repository at this point in the history
Update action.yaml
  • Loading branch information
seantomburke authored Jul 22, 2021
2 parents 5f189f9 + 6337f49 commit 95acfbd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,23 @@ jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
runs-on: macos-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2


- name: Install MySQL 5.7
shell: bash
run: |
brew install mysql
brew install [email protected]
brew unlink mysql && brew link [email protected]
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> /Users/runner/.bash_profile
bash
mysql --version
mysqldump --version
# Runs a single command using the runners shell
- name: Check MySQL schemas
uses: ./
Expand Down
9 changes: 6 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,19 @@ runs:
pwd1=${{ inputs.password1 }};
db1=${{ inputs.database1 }};
echo "Connecting to DB1"
mysqldump --defaults-extra-file=<(printf '[client]\nuser = %s\npassword = %s\nhost = %s' $user1 $pwd1 $host1) -d --column-statistics=0 --no-tablespaces --skip-add-drop-table --skip-add-drop-database --single-transaction $db1 | sed -e 's/AUTO_INCREMENT=[[:digit:]]* //' | sed -e 's/Host: .* //' | sed -e 's/-- Dump completed on .*//' > db1.sql
mysqldump --defaults-extra-file=<(printf '[client]\nuser = %s\npassword = %s\nhost = %s' $user1 $pwd1 $host1) -d --skip-add-drop-table --skip-add-drop-database --single-transaction $db1 | sed -e 's/AUTO_INCREMENT=[[:digit:]]* //' | sed -e 's/Host: .* //' | sed -e 's/-- Dump completed on .*//' > db1.sql
if [[ $? -ne 0 ]]; then
echo >&2 "SQL error"
exit 1
fi
echo "db1.sql created"
# Use details to connect to dev and mysqldump the tables without data
user2=${{ inputs.username2 }}
host2=${{ inputs.hostname2 }}
pwd2=${{ inputs.password2 }}
db2=${{ inputs.database2 }}
echo "Connecting to DB2"
mysqldump --defaults-extra-file=<(printf '[client]\nuser = %s\npassword = %s\nhost = %s' $user2 $pwd2 $host2) -d --column-statistics=0 --no-tablespaces --skip-add-drop-table --skip-add-drop-database --single-transaction $db2 | sed -e 's/AUTO_INCREMENT=[[:digit:]]* //' | sed -e 's/Host: .* //' | sed -e 's/-- Dump completed on .*//' > db2.sql
echo "db2.sql created"
mysqldump --defaults-extra-file=<(printf '[client]\nuser = %s\npassword = %s\nhost = %s' $user2 $pwd2 $host2) -d --skip-add-drop-table --skip-add-drop-database --single-transaction $db2 | sed -e 's/AUTO_INCREMENT=[[:digit:]]* //' | sed -e 's/Host: .* //' | sed -e 's/-- Dump completed on .*//' > db2.sql
if [[ $? -ne 0 ]]; then
echo >&2 "SQL error"
exit 1
Expand Down

0 comments on commit 95acfbd

Please sign in to comment.