bump mysql ver in workflow #26
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: Django CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
- ApplicationCredentials | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: [ 3.9 ] | |
services: | |
mysql: | |
image: mysql:8 | |
env: | |
MYSQL_ROOT_PASSWORD: random_pass | |
MYSQL_DATABASE: mysql | |
ports: [ '3306:3306' ] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9.20 | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run Migrations | |
run: python manage.py migrate | |
env: | |
MYSQL_NAME: mysql | |
MYSQL_USER: root | |
MYSQL_PASSWORD: random_pass | |
MYSQL_HOST: 127.0.0.1 | |
MYSQL_PORT: 3306 | |
MYSQL_DATABASE: mysql | |
- name: Run Tests | |
run: | | |
python manage.py test | |
env: | |
MYSQL_NAME: mysql | |
MYSQL_USER: root | |
MYSQL_PASSWORD: random_pass | |
MYSQL_HOST: 127.0.0.1 | |
MYSQL_PORT: 3306 | |
MYSQL_DATABASE: mysql | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y%m%d')" | |
- name: Get current datetime | |
id: datetime | |
run: echo "::set-output name=datetime::$(date +'%Y%m%d_%H%M')" | |
- name: Login to Docker Hub | |
uses: docker/#-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
prerelease: true | |
- name: Build and push DockerHub | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/novamanager:${{ steps.tag_version.outputs.new_version }}, ${{ secrets.DOCKER_HUB_USERNAME }}/novamanager:${{ steps.tag_version.outputs.new_tag }}, ${{ secrets.DOCKER_HUB_USERNAME }}/novamanager:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/novamanager:${{ steps.date.outputs.date }}, ${{ secrets.DOCKER_HUB_USERNAME }}/novamanager:${{ steps.datetime.outputs.datetime }} | |
#- name: Log in to the Container registry Github | |
# uses: docker/#-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
# with: | |
# registry: ${{ env.REGISTRY }} | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
#- name: Build and push | |
# uses: docker/build-push-action@v2 | |
# with: | |
# context: . | |
# file: ./Dockerfile | |
# push: true | |
# tags: ghcr.io/${{ github.actor }}/novamanager:${{ steps.tag_version.outputs.new_version }} | |
# tags: ${{ env.REGISTRY }}/novamanager:${{ steps.tag_version.outputs.new_version }}, ${{ env.REGISTRY }}/novamanager:${{ steps.tag_version.outputs.new_tag }}, ${{ env.REGISTRY }}/novamanager:latest, ${{ env.REGISTRY }}/novamanager:${{ steps.date.outputs.date }}, ${{ env.REGISTRY }}/novamanager:${{ steps.datetime.outputs.datetime }} |