Add GitHub Actions CI/CD pipeline with build badge
This commit is contained in:
parent
6f301e7f4c
commit
d1a475a5dc
2 changed files with 68 additions and 0 deletions
60
.github/workflows/docker-publish.yml
vendored
Normal file
60
.github/workflows/docker-publish.yml
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
name: Docker Build & Publish
|
||||||
|
|
||||||
|
# This tells GitHub: "Run this every time I push code to the main branch"
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
# Also run if I create a Release tag (e.g., v1.0)
|
||||||
|
tags: [ 'v*.*.*' ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Use GitHub's built-in registry (ghcr.io)
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
# Use the repository name as the image name
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write # Needed to push the image to GHCR
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Set up Docker Buildx (The builder engine)
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
# Login to GitHub Container Registry using the automatic GitHub Token
|
||||||
|
- name: Log into registry ${{ env.REGISTRY }}
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# Generate tags (e.g., :latest, :v1.0, :main)
|
||||||
|
- name: Extract Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
type=ref,event=branch
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
|
||||||
|
# Build the image and push it to the registry
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
@ -1,7 +1,15 @@
|
||||||
# 🤖 Universal Reddit Scraper
|
# 🤖 Universal Reddit Scraper
|
||||||
|
|
||||||
|
[](https://github.com/ksanjeev284/reddit-universal-scraper/actions/workflows/docker-publish.yml)
|
||||||
|
|
||||||
A robust, dual-mode Reddit scraper designed to run on low-resource servers (like AWS Free Tier).
|
A robust, dual-mode Reddit scraper designed to run on low-resource servers (like AWS Free Tier).
|
||||||
|
|
||||||
|
## 🐳 Quick Start (No Installation Needed!)
|
||||||
|
```bash
|
||||||
|
# Pull the pre-built image and run
|
||||||
|
docker run -d -v $(pwd)/data:/app/data ghcr.io/ksanjeev284/reddit-universal-scraper:latest CreditCardsIndia --mode monitor
|
||||||
|
```
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- **Zero API Keys Needed:** Uses RSS feeds and Public Mirrors (Redlib) to bypass API limits.
|
- **Zero API Keys Needed:** Uses RSS feeds and Public Mirrors (Redlib) to bypass API limits.
|
||||||
- **Dual Modes:**
|
- **Dual Modes:**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue