Files
Website/.github/workflows/docker-push.yml
2021-11-14 19:59:32 +01:00

62 lines
1.6 KiB
YAML

name: Docker
on:
push:
branches:
- master
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
env:
IMAGE_NAME: website
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update apt
run: sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
- name: Install Python3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
architecture: x64
- name: Update pip
run: pip install -U pip
- name: Install pipenv
run: pip install pipenv
- name: Lock pip dependencies
run: pipenv lock --pre --clear
- name: Install dependencies
run: pipenv install
- name: Export to requirements.txt
run: pipenv lock -r > requirements.txt
- name: Collecting static
run: SECRET_KEY=secret pipenv run ./manage.py collectstatic --noinput
- name: Preparing migrations
run: SECRET_KEY=secret pipenv run ./manage.py makemigrations
- name: Updating package.json
run: npm update
- name: Fixing audit npm bugs
run: npm audit fix
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: marcpartensky/website:latest