gitscope
← rgit / 0.1.4 / .github/workflows/docker-publish.yml
https://dev.kronoz.win/r/rgit.git
.github/workflows/docker-publish.yml · YAML
Blame Raw
 1name: Docker
 2
 3on:
 4  schedule:
 5    - cron: '45 20 * * *'
 6  push:
 7    branches: [ main ]
 8
 9env:
10  # Use docker.io for Docker Hub if empty
11  REGISTRY: ghcr.io
12  # github.repository as <account>/<repo>
13  IMAGE_NAME: ${{ github.repository }}
14
15jobs:
16  build:
17    runs-on: ubuntu-latest
18    permissions:
19      contents: read
20      packages: write
21    steps:
22      - name: Checkout repository
23        uses: actions/checkout@v2
24      - name: Setup Docker buildx
25        uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
26      - name: Log into registry ${{ env.REGISTRY }}
27        if: github.event_name != 'pull_request'
28        uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
29        with:
30          registry: ${{ env.REGISTRY }}
31          username: ${{ github.actor }}
32          password: ${{ secrets.GITHUB_TOKEN }}
33      - name: Extract Docker metadata
34        id: meta
35        uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
36        with:
37          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38      - name: Build and push Docker image
39        id: build-and-push
40        uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
41        with:
42          context: .
43          push: ${{ github.event_name != 'pull_request' }}
44          tags: ${{ steps.meta.outputs.tags }}
45          labels: ${{ steps.meta.outputs.labels }}