diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77e8ee26..c49ee44a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,23 +2,35 @@ name: Build Docker Image on: push: - branches: - - 'develop' - - 'influxdbv2' + branches: + - "develop" tags: - - 'v*.*.*' + - "*" + paths-ignore: + - "assets/**" + - "data/**" + - "systemd/**" + - "README.md" + - "renovate.json" + pull_request: + branches: + - "develop" + paths-ignore: + - "assets/**" + - "data/**" + - "systemd/**" + - "README.md" + - "renovate.json" jobs: - - build: - + build-and-push-docker: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Cache Docker layers uses: actions/cache@v3 @@ -28,33 +40,39 @@ jobs: - name: Docker meta id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: | - ghcr.io/thezak48/varken + ghcr.io/thezak48/manga_dl + flavor: | + latest=auto tags: | - type=schedule - type=ref,event=pr + type=raw,value=latest,enable={{is_default_branch}} type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} + type=edge,branch=develop + type=ref,event=pr type=sha - type=ref,event=branch - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + + - name: Login to GHCR + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.CR_ZAK }} - name: Docker build and push - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: . platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} + push: ${{ github.event.pull_request.head.repo.full_name == 'thezak48/manga_dl' || github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache \ No newline at end of file + cache-to: type=local,dest=/tmp/.buildx-cache + build-args: | + BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') + VCS_REF=${{ github.sha }} + VERSION=${{ steps.meta.outputs.tags }}