podcastrr/.forgejo/workflows/build.yml
Cody Cook 9e19ae6cf6
Some checks failed
Build and Publish / test (push) Successful in 20s
Build and Publish / build (push) Failing after 5m33s
Build and Publish / notify (push) Successful in 1s
Add a test and make changez?
2025-06-17 20:36:20 -07:00

85 lines
2.5 KiB
YAML

name: Build and Publish
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
jobs:
test:
runs-on: docker
steps:
- uses: actions/checkout@v4
- name: Check Python version
run: |
python3 --version
- name: Install dependencies
run: |
apt-get update && apt-get install -y python3-pip
pip3 install --upgrade pip
pip3 install -r requirements.txt
- name: Run tests
run: |
python3 -m pytest
build:
needs: test
runs-on: docker
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Forgejo Container Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.FORGEJO_REGISTRY }}
username: ${{ secrets.FORGEJO_USERNAME }}
password: ${{ secrets.FORGEJO_PASSWORD }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ secrets.FORGEJO_REGISTRY }}/${{ secrets.FORGEJO_USERNAME }}/podcastrr
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=sha,format=short
latest
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ secrets.FORGEJO_REGISTRY }}/${{ secrets.FORGEJO_USERNAME }}/podcastrr:buildcache
cache-to: type=registry,ref=${{ secrets.FORGEJO_REGISTRY }}/${{ secrets.FORGEJO_USERNAME }}/podcastrr:buildcache,mode=max
- name: Echo package URL
run: |
echo "Docker package published to: ${{ secrets.FORGEJO_REGISTRY }}/${{ secrets.FORGEJO_USERNAME }}/podcastrr"
echo "You can use this package in your docker-compose.yml with: image: ${{ secrets.FORGEJO_REGISTRY }}/${{ secrets.FORGEJO_USERNAME }}/podcastrr:latest"
notify:
needs: [build]
runs-on: docker
if: always()
steps:
- name: Notify about build status
run: |
echo "Build completed with status: ${{ job.status }}"
# Add webhook notification or other notification methods if needed