-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (76 loc) · 2.14 KB
/
publish.yml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Docker
on:
workflow_dispatch:
push:
pull_request:
env:
REGISTRY: ghcr.io
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- context: .
target: django
image: ghcr.io/ninanor/nina-catalogue-django
- context: ./nginx
image: ghcr.io/ninanor/nina-catalogue-nginx
- context: ./varnish
image: ghcr.io/ninanor/nina-catalogue-varnish
- context: ./docs
image: ghcr.io/ninanor/nina-catalogue-docs
target: prod
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
tags: |
type=ref,event=branch
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
target: ${{ matrix.target }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
publish_docs:
if: github.ref == 'refs/heads/master'
needs: build
runs-on: ubuntu-latest
container:
image: ghcr.io/ninanor/nina-catalogue-docs:master
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
permissions:
pages: write
id-token: write
environment:
# environment created automatically by GitHub
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "/var/www"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2