name: CI on: push: pull_request: schedule: # Weekly image refresh for yt-dlp and the base images. Gitea reads cron in # UTC: Saturday 23:00 EDT / 22:00 EST on mainframe, ahead of # podman-stack-update.timer pulling :latest at Sunday 04:00 local. - cron: '0 3 * * 0' jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: token: ${{ secrets.GITEA }} - name: Configure git to use HTTPS for submodules run: | git config --global url."https://${{ secrets.GITEA }}@git.rcjohnstone.com/".insteadOf "ssh://connor@git.rcjohnstone.com:2222/" git submodule update --init --recursive - uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy - run: cargo fmt --check - run: cargo clippy --workspace -- -D warnings - run: cargo build --workspace - run: cargo test --workspace docker: runs-on: ubuntu-latest needs: check if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'schedule') steps: - uses: actions/checkout@v4 with: token: ${{ secrets.GITEA }} - name: Configure git to use HTTPS for submodules run: | git config --global url."https://${{ secrets.GITEA }}@git.rcjohnstone.com/".insteadOf "ssh://connor@git.rcjohnstone.com:2222/" git submodule update --init --recursive - name: Log in to container registry run: echo "${{ secrets.GITEA }}" | docker login git.rcjohnstone.com -u connor --password-stdin - name: Build and push run: | extra_args="" if [ "${{ github.event_name }}" = "schedule" ]; then extra_args="--pull --build-arg YTDLP_REFRESH=$(date -u +%Y-%m-%d)" fi docker build $extra_args -t git.rcjohnstone.com/connor/shanty:latest -t git.rcjohnstone.com/connor/shanty:${{ github.sha }} . docker push git.rcjohnstone.com/connor/shanty:latest docker push git.rcjohnstone.com/connor/shanty:${{ github.sha }}