Update docker-publish.yml #211
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: Publish Docker image | |
on: | |
push: | |
branches: [ "dev", "master" ] | |
pull_request_target: | |
types: [opened, reopened, synchronize, ready_for_review] | |
branches: [ "dev", "master" ] | |
# Publish `v1.2.3` tags as releases. | |
tags: | |
- v* | |
jobs: | |
mysql57: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'WIP') | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Shutdown existing MySQL | |
run: sudo service mysql stop | |
push_to_registries: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'WIP') | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Set up MySQL | |
uses: cweinberger/github-actions-mysql@main | |
with: | |
version: 5.7 | |
hostPort: 3306 | |
containerPort: 3306 | |
rootPassword: root | |
user: TestUser | |
password: TestPassword | |
database: TestDatabase | |
characterSet: utf8mb4 | |
collation: utf8mb4_general_ci | |
sqlMode: NO_ENGINE_SUBSTITUTION | |
- name: Print running docker containers | |
run: docker ps | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Get branch name | |
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
- name: Identify git repo path | |
run: ls $GITHUB_WORKSPACE && ls -l /home/runner/work/ | |
- name: Wait for MySQL | |
run: sleep 15 | |
- name: Debug environment variables | |
run: | | |
echo "Admin Login: $MYSQL_ADMIN_LOGIN" | |
echo "Admin Password: $MYSQL_ADMIN_PASSWORD" | |
echo "DB Host: $BLUECHERRY_DB_HOST" | |
- name: Install Bluecherry Package | |
run: | | |
{ | |
echo bluecherry bluecherry/mysql_admin_login string $MYSQL_ADMIN_LOGIN; | |
echo bluecherry bluecherry/mysql_admin_password password $MYSQL_ADMIN_PASSWORD; | |
echo bluecherry bluecherry/db_host string $BLUECHERRY_DB_HOST; | |
echo bluecherry bluecherry/db_userhost string $BLUECHERRY_DB_ACCESS_HOST; | |
echo bluecherry bluecherry/db_name string $BLUECHERRY_DB_NAME; | |
echo bluecherry bluecherry/db_user string $BLUECHERRY_DB_USER; | |
echo bluecherry bluecherry/db_password password $BLUECHERRY_DB_PASSWORD; | |
} | debconf-set-selections && apt install -y --no-install-recommends ./bluecherry-apps/releases/bluecherry_*.deb | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: bluecherrydvr/bluecherry | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |