mirror of
https://github.com/ShayManor/github-readme-stats.git
synced 2026-12-02 11:53:48 +05:30
feat(readme): update Docker badge to reflect new deployment workflow.
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
name: build and deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build ${{ matrix.service }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
service: [fetcher, generator, edge]
|
||||
outputs:
|
||||
image_tag: ${{ steps.tag.outputs.value }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GHCR
|
||||
if: github.event_name == 'push'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Compute image tag (sha-<short>)
|
||||
id: tag
|
||||
env:
|
||||
SHA: ${{ github.sha }}
|
||||
run: echo "value=sha-${SHA:0:7}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Compute image name (lowercase)
|
||||
id: img
|
||||
env:
|
||||
OWNER: ${{ github.repository_owner }}
|
||||
SERVICE: ${{ matrix.service }}
|
||||
run: echo "name=${REGISTRY}/${OWNER,,}/ghstats-${SERVICE}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ steps.img.outputs.name }}
|
||||
tags: |
|
||||
type=raw,value=${{ steps.tag.outputs.value }}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build ${{ matrix.service }} image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./${{ matrix.service }}
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha,scope=${{ matrix.service }}
|
||||
cache-to: type=gha,mode=max,scope=${{ matrix.service }}
|
||||
|
||||
deploy:
|
||||
name: deploy to mini PC
|
||||
needs: build
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
runs-on: [self-hosted, minipc]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Deploy compose stack
|
||||
env:
|
||||
IMAGE_TAG: ${{ needs.build.outputs.image_tag }}
|
||||
GITHUB_PAT: ${{ secrets.FETCHER_GITHUB_PAT }}
|
||||
FETCHER_INTERNAL_TOKEN: ${{ secrets.FETCHER_INTERNAL_TOKEN }}
|
||||
run: ./deploy/deploy.sh
|
||||
Reference in New Issue
Block a user