From 82180d0ce6cfc2d95944f65bd8eed689a7bd43af Mon Sep 17 00:00:00 2001 From: aserper Date: Sat, 13 Dec 2025 23:26:15 -0500 Subject: [PATCH] Optimize CI: Consolidate testing and release into single pipeline --- .github/workflows/{test.yml => ci.yml} | 58 ++++++++++++++++++++++++- .github/workflows/masto-rss.yml | 59 -------------------------- 2 files changed, 57 insertions(+), 60 deletions(-) rename .github/workflows/{test.yml => ci.yml} (71%) delete mode 100644 .github/workflows/masto-rss.yml diff --git a/.github/workflows/test.yml b/.github/workflows/ci.yml similarity index 71% rename from .github/workflows/test.yml rename to .github/workflows/ci.yml index e5c250e..acd709d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Tests +name: CI/CD Pipeline on: push: @@ -160,3 +160,59 @@ jobs: exit 1 fi echo "All tests passed successfully!" + + deploy-image: + name: Build & Push Image + needs: [all-tests-pass] + # Only run on push to main, not on PRs (though PRs are implicitly filtered by `push` check in `if` usually, explicit is better) + # Actually, we want to run this job only if it IS a push event. + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: amitserper + password: ${{ secrets.DH_PASSWORD }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: | + amitserper/masto-rss + ghcr.io/aserper/masto-rss + tags: | + type=ref,event=branch + type=sha,prefix={{branch}}- + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push multiarch image + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/masto-rss.yml b/.github/workflows/masto-rss.yml deleted file mode 100644 index c65e441..0000000 --- a/.github/workflows/masto-rss.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Masto-rss - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: amitserper - password: ${{ secrets.DH_PASSWORD }} - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: | - amitserper/masto-rss - ghcr.io/aserper/masto-rss - tags: | - type=ref,event=branch - type=sha,prefix={{branch}}- - type=raw,value=latest,enable={{is_default_branch}} - - - name: Build and push multiarch image - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max