Skip to content

Nightly Release

Nightly Release #266

name: Nightly Release
on:
schedule:
- cron: "0 0 * * SUN,WED"
workflow_dispatch: {}
jobs:
check-date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.check.outputs.should_run }}
steps:
- uses: actions/checkout@v3
- id: check
run: |
test -n "$(git rev-list --after="24 hours" ${{ github.sha }})" \
&& echo "should_run=true" >>$GITHUB_OUTPUT \
|| echo "should_run=false" >>$GITHUB_OUTPUT
test-frontend:
name: Lint and test frontend
needs: check-date
if: ${{ needs.check-date.outputs.should_run == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install dependencies
run: npm install
working-directory: betanin_client
- name: Lint
run: npm run lint
working-directory: betanin_client
- name: Check formatting
run: npm run check-formatting
working-directory: betanin_client
test-backend:
name: Lint and test backend
needs: check-date
if: ${{ needs.check-date.outputs.should_run == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9.x
- name: Install dependencies
run: pip install --user . .[dev]
- name: Check imports
run: isort --check-only $(git ls-files "*.py")
- name: Check formatting
run: black --check $(git ls-files "*.py")
- name: Check types
if: ${{ false }} # do not have the energy for python right now
run: pyright .
build-release:
name: Build and release Docker image
needs: [check-date, test-frontend, test-backend]
if: ${{ needs.check-date.outputs.should_run == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
driver-opts: image=moby/buildkit:master
- name: Login into DockerHub
run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Login into GitHub Container Registry
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Generate short hash
run: |
_short_hash=${{ github.sha }}
echo "SHORT_HASH=${_short_hash:0:7}" >> $GITHUB_ENV
- name: Build and Push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ env.SHORT_HASH }}
ghcr.io/${{ github.repository }}:nightly
${{ github.repository }}:${{ env.SHORT_HASH }}
${{ github.repository }}:nightly