fix: corrects username validator regex so it allows all valid usernam… #126
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: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- main | |
- develop | |
tags: | |
- "v*" | |
env: | |
IMAGE_NAME: unitystation/central-command | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- uses: pre-commit/[email protected] | |
unit_test: | |
needs: [ lint ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
pip install poetry | |
poetry config virtualenvs.create false | |
poetry install | |
- name: Run tests | |
env: | |
SECRET_KEY: secret | |
DB_ENGINE: django.db.backends.sqlite3 | |
run: | | |
cd src | |
python manage.py migrate | |
python manage.py test tests/ | |
build_docker: | |
needs: [ lint ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build Docker image | |
run: | | |
docker pull $IMAGE_NAME | |
docker build --pull --cache-from $IMAGE_NAME -t $IMAGE_NAME . | |
deploy: | |
needs: [ unit_test, build_docker ] | |
if: ${{ github.event_name == 'push' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v2 | |
- name: Build image | |
run: | | |
docker pull $IMAGE_NAME | |
docker build --pull --cache-from $IMAGE_NAME -t $IMAGE_NAME:latest . | |
- name: Log in into Docker Hub | |
run: | | |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
# Context: | |
# For some reason, commits from semantic-release bot do not trigger any actions. | |
# Build/push steps were copied into release workflow until we figure out a better way. | |
# - name: Add a release tag to image | |
# if: contains(github.ref, 'refs/tags/') | |
# run: | | |
# docker tag $IMAGE_NAME $IMAGE_NAME:${GITHUB_REF#refs/tags/} | |
- name: Push image to registry | |
run: | | |
docker push $IMAGE_NAME |