aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/docker.yaml
blob: 772a61ad6f97a3a12836ecdddb94a939cb3a8968 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Docker 🐳

on:
  workflow_dispatch:
  workflow_run:
    workflows: ["Check ✅"]
    types:
      - completed

jobs:
  docker:
    name: Docker 🐳
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛒
        if: startsWith(github.ref, 'refs/tags/v')
        uses: actions/checkout@v3

      - name: Login to DockerHub 🐳
        uses: docker/login-action@v2
        if: startsWith(github.ref, 'refs/tags/v')
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Docker Meta 📄
        id: meta
        if: startsWith(github.ref, 'refs/tags/v')
        uses: docker/metadata-action@v4
        with:
          images: |
            fuwn/september
          tags: |
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}

      - name: Build and Push ⚙
        uses: docker/build-push-action@v3
        if: startsWith(github.ref, 'refs/tags/v')
        with:
          push: startsWith(github.ref, 'refs/tags/v')
          context: .
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}

      - name: Deploy 🚀
        uses: distributhor/workflow-webhook@v2
        if: startsWith(github.ref, 'refs/tags/v')
        env:
          webhook_url: ${{ secrets.WEBHOOK_URL }}
          webhook_secret: september