-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (66 loc) · 2.1 KB
/
publish-docker.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
name: Build and Publish Docker images
on:
- push
- workflow_dispatch
permissions:
packages: write
jobs:
website:
name: Website Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3.5.1
with:
node-version-file: package.json
- name: Enable corepack
run: corepack enable
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Cache Yarn packages
uses: actions/cache@v3.3.1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
yarn install --immutable
- name: Build website
run: yarn run build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.9.1
- name: Extract metadata (tags, labels) for website
id: website-meta
uses: docker/metadata-action@v4.6.0
with:
images: ghcr.io/MatthiasKunnen/icarus-pedia/website
labels: |
org.opencontainers.image.title=IcarusPedia website
tags: |
type=edge,branch=master
type=ref,event=branch
type=ref,event=tag
type=sha
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push website Docker image
uses: docker/build-push-action@v4.1.1
with:
build-args: |
REVISION=${{ github.sha }}
context: .
file: ./Dockerfile
labels: ${{ steps.website-meta.outputs.labels }}
push: true
tags: ${{ steps.website-meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max