-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (150 loc) · 4.85 KB
/
build.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Build
on:
push:
branches:
- master
paths-ignore:
- '.github/**'
- '.editorconfig'
- '.gitignore'
- '**/*.md'
workflow_dispatch:
inputs:
head:
default: develop
jobs:
update:
if: github.repository == 'misskey-dev/0key.dev'
runs-on: ubuntu-latest
steps:
- if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4.1.6
with:
fetch-depth: 0
submodules: recursive
- if: github.event_name == 'workflow_dispatch'
run: |
git branch -r --format '%(refname:short)' | while read r;
do git branch --track "${r#origin/}" "$r" || :;
done
git fetch --all || :
git pull --all --ff-only || :
git checkout "$HEAD"
env:
HEAD: ${{ github.event.inputs.head }}
working-directory: misskey
- if: github.event_name == 'workflow_dispatch'
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
git add misskey
git commit -m "chore: update misskey-dev/misskey@$(cd misskey; git rev-parse HEAD)" || :
git push
env:
HEAD: ${{ github.event.inputs.head }}
docker-hariko:
if: github.repository == 'misskey-dev/0key.dev'
needs:
- update
runs-on: ubuntu-latest
permissions:
packages: write
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v4.1.6
- if: github.event_name == 'workflow_dispatch'
run: |
git pull --ff-only
git submodule update
- uses: docker/login-action@v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: build
run: |
docker build -t "ghcr.io/misskey-dev/0key.dev:$GITHUB_REF_NAME-hariko" .
docker push "ghcr.io/misskey-dev/0key.dev:$GITHUB_REF_NAME-hariko"
echo "digest=$(docker image ls --format '{{.Digest}}' | head -n1)" > $GITHUB_OUTPUT
working-directory: hariko
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
docker-misskey:
if: github.repository == 'misskey-dev/0key.dev'
needs:
- update
runs-on: ubuntu-latest
permissions:
packages: write
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v4.1.6
with:
submodules: true
- if: github.event_name == 'workflow_dispatch'
run: |
git pull --ff-only
git submodule update
- uses: docker/login-action@v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: Homebrew/actions/setup-homebrew@master
- id: build
run: |
head=$(git rev-parse HEAD)
repository=$(mktemp -d)
cd $repository
git init
git remote add origin https://github.com/misskey-dev/misskey.git
git fetch origin $head
git checkout FETCH_HEAD
brew install jaq
jaq --in-place ".version += \"-commit.$(git log --oneline | wc -l)+$(git rev-parse HEAD)\"" package.json
docker build -t "ghcr.io/misskey-dev/0key.dev:$GITHUB_REF_NAME-misskey" .
docker push "ghcr.io/misskey-dev/0key.dev:$GITHUB_REF_NAME-misskey"
echo "digest=$(docker image ls --format '{{.Digest}}' | head -n1)" > $GITHUB_OUTPUT
working-directory: misskey
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
helm:
if: github.repository == 'misskey-dev/0key.dev'
needs:
- docker-hariko
- docker-misskey
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4.1.6
with:
fetch-depth: 0
- if: github.event_name == 'workflow_dispatch'
run: |
git pull --ff-only
git submodule update
- id: version
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
echo revision=$(git log --oneline | wc -l) > $GITHUB_OUTPUT
- uses: azure/setup-helm@v4.2.0
with:
version: v3.15.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: mikefarah/yq@v4.44.1
with:
cmd: |
yq -i ".version += \\"${{ steps.version.outputs.revision }}\\"" charts/hariko/Chart.yaml
yq -i ".version += \\"${{ steps.version.outputs.revision }}\\"" charts/misskey/Chart.yaml
yq -i ".image.index = \\"ghcr.io/misskey-dev/0key.dev@${{ needs.docker-hariko.outputs.digest }}\\"" charts/hariko/values.yaml
yq -i ".image.index = \\"ghcr.io/misskey-dev/0key.dev@${{ needs.docker-misskey.outputs.digest }}\\"" charts/misskey/values.yaml
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
- uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }}