-
Notifications
You must be signed in to change notification settings - Fork 3
91 lines (80 loc) · 2.5 KB
/
docker-nightly.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
89
90
91
name: Docker Nightly
on:
push:
paths-ignore:
- "*.md"
- ".github/**"
- "!.github/workflows/docker-nightly.yml"
branches:
- main
workflow_dispatch:
jobs:
determine-changes:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set matrix
id: set-matrix
run: |
APPS=("website" "telegram-game")
CHANGED=()
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
CHANGED=("${APPS[@]}")
else
for app in "${APPS[@]}"; do
folder="apps/${app}"
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q "^${folder}/"; then
CHANGED+=("${app}")
fi
done
fi
if [ ${#CHANGED[@]} -gt 0 ]; then
echo "matrix=$(printf '%s\n' "${CHANGED[@]}" | jq -R . | jq -s . | tr -d '[:space:]')" >> $GITHUB_OUTPUT
else
echo "matrix=[]" >> $GITHUB_OUTPUT
fi
- name: Result
run: |
echo "${{ steps.set-matrix.outputs.matrix }}"
build:
needs: determine-changes
if: ${{ needs.determine-changes.outputs.matrix != '[]' }}
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
matrix:
app: ${{ fromJson(needs.determine-changes.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Latest Corepack
run: |
echo "Before: corepack version => $(corepack --version || echo 'not installed')"
npm install -g corepack@latest
echo "After : corepack version => $(corepack --version)"
corepack enable
pnpm --version
- name: Set APP in env
run: |
echo "APP_NAME=${{ matrix.app }}" >> $GITHUB_ENV
echo "APP_VERSION=nightly" >> $GITHUB_ENV
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build ${{ matrix.package }}
uses: docker/build-push-action@v6
with:
context: .
file: docker/${{ env.APP_NAME }}/Dockerfile
push: true
tags: ${{ secrets.NAMESPACE }}/${{ env.APP_NAME }}:${{ env.APP_VERSION }}