revert changes #30
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: CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: pipenv | |
- name: Install pipenv and dependencies | |
run: | | |
pip install --user pipenv | |
pipenv install --dev --deploy | |
- name: Check formatting with isort and black | |
run: | | |
pipenv run black --check . | |
pipenv run isort --check-only --profile black . | |
build-and-push-image: | |
name: Build and Push Docker Image | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
needs: | |
- check | |
if: success() && github.ref_name == 'master' && github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
if: github.event_name != 'pull_request' # don't need to login if we're not pushing | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/uwcs/vote | |
tags: | # tag with commit hash and with 'latest' | |
type=sha | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and Push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} # dont push on a pull request | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |