summaryrefslogtreecommitdiff
path: root/.forgejo/workflows/forgejo-deb.yml
blob: 7b969fd9acc684a9414e16c605ab4510231d5703 (plain)
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
on: [push, pull_request]
jobs:
  mirror:
    runs-on: bookworm
    if: github.event_name == 'push' && github.repository == 'forgejo-contrib/forgejo-deb'
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: "mirror repo: code.forgejo.org"
        env:
          FORGEJO_DEST: code.forgejo.org
          FORGEJO_KEY: ${{ secrets.cfo_api_key }}
        run: ./.action-forgejo-mirror.sh

  build-forgejo-deb:
    runs-on: bullseye
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: true

      - uses: actions/setup-node@v3
        with:
          node-version: 20

      - uses: actions/setup-go@v4
        with:
          go-version: "1.22"
          check-latest: true

      - name: "actions prep: build-forgejo-deb"
        id: ciprep
        run: ./.ci-make.sh actions-prep build-forgejo-deb

      - name: fetch tags
        run: |
          git config --add safe.directory '*'
          git fetch --tags --force
          git submodule foreach 'git fetch --tags --force'
      
      - uses: crystal/install-jq-action@v2.1.0
      - run: ./.ci-make.sh ci-verify forgejo

      - run: ./.ci-make.sh submodule-make forgejo deps-frontend
      - run: ./.ci-make.sh submodule-make forgejo deps-backend

      - name: tag pre-condition
        run: |
          cd forgejo
          git update-ref refs/heads/tag_test $(git rev-parse --verify HEAD)

      - run: ./.ci-make.sh submodule-make forgejo security-check
      
      - run: ./.ci-make.sh submodule-make forgejo frontend

      - run: ./.ci-make.sh submodule-make forgejo checks-backend

      - name: Download Forgejo binary
        run: ./.ci-make.sh download-binary forgejo-bin-dl

      - name: Build Forgejo for amd64
        run: ./.ci-make.sh submodule-build forgejo forgejo-bin
        env:
          TAGS: bindata

      - name: Build Forgejo (with SQLite) for amd64
        run: ./.ci-make.sh submodule-build forgejo forgejo-sqlite-bin
        env:
          TAGS: bindata sqlite sqlite_unlock_notify

      - run: ./.ci-make.sh package-prep
      - run: ./.ci-make.sh package-build-deps

      - run: ./.ci-make.sh package-build actions

      - run: ./.ci-make.sh package-clean

      - name: build repo package
        run: |
          cd repo-deb
          ./build.sh actions

      - name: generate sha256
        run: |
          ./.ci-make.sh pkg-gen-sha256
          ./.ci-make.sh preview-sha256

      - run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb

      - uses: actions/upload-artifact@v3
        with:
          name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
          path: |
            *.deb
            *.deb.sha256
            repo-deb/*.deb

  installtest-bookworm-sqlite:
    runs-on: bookworm
    steps:
      - uses: actions/checkout@v4
        
      - name: "actions prep: installtest"
        id: ciprep
        run: ./.ci-make.sh actions-prep installtest

      - uses: actions/download-artifact@v3
        with:
          name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}

      - run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb

  installtest-bullseye-sqlite:
    runs-on: bullseye
    steps:
      - uses: actions/checkout@v4

      - name: "actions prep: installtest"
        id: ciprep
        run: ./.ci-make.sh actions-prep installtest
        
      - uses: actions/download-artifact@v3
        with:
          name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}

      - run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb

  installtest-buster-sqlite:
    runs-on: buster
    steps:
      - uses: actions/checkout@v4
        
      - name: "actions prep: installtest"
        id: ciprep
        run: ./.ci-make.sh actions-prep installtest

      - uses: actions/download-artifact@v3
        with:
          name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}

      - run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb

  installtest-bookworm-user:
    runs-on: bookworm
    steps:
      - uses: actions/checkout@v4

      - name: "actions prep: installtest"
        id: ciprep
        run: ./.ci-make.sh actions-prep installtest

      - uses: actions/download-artifact@v3
        with:
          name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}

      - run: ./.ci-make.sh test-userinst-prep
      - run: ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb

  testsuite-repo-upgrade-sqlite:
    runs-on: bookworm
    steps:
      - uses: actions/checkout@v4

      - name: "actions prep: installtest"
        id: ciprep
        run: ./.ci-make.sh actions-prep installtest

      - uses: actions/download-artifact@v3
        with:
          name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}

      - run: ./.ci-make.sh install-repo-test ./repo-deb/forgejo-deb-repo_0-0_all.deb forgejo-sqlite
      - run: ./.ci-make.sh force-clean-forgejo
      - run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
      - run: ./.ci-make.sh verify-data-dir-chmod

  installtest-buster-bin:
    runs-on: buster
    steps:
      - uses: actions/checkout@v4

      - name: "actions prep: installtest"
        id: ciprep
        run: ./.ci-make.sh actions-prep installtest

      - uses: actions/download-artifact@v3
        with:
          name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}

      - run: ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb

  publish-repo-deb:
    runs-on: bookworm
    if: github.event_name == 'push' && github.repository == 'forgejo-contrib/forgejo-deb'
    steps:
      - uses: actions/checkout@v4

      - name: actions prep
        id: ciprep
        run: ./.ci-make.sh actions-prep installtest

      - uses: actions/download-artifact@v3
        with:
          name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}

      - uses: crystal/install-jq-action@v2.1.0

      - run: sudo apt install -y wget
      - run: wget --content-disposition https://code.forgejo.org/forgejo-contrib/-/packages/debian/forgejo-deb-repokey/2-1/files/2918

      - name: "Debian package registry publish: forgejo-deb-repokey"
        env:
          FORGEJO_SITE: https://code.forgejo.org
          FORGEJO_OWNER: forgejo-contrib
          DEBIAN_DIST: bullseye
          DEBIAN_COMPONENT: forgejo-lts
          FORGEJO_KEY: ${{ secrets.cfo_api_key }}
        run: |
          ./.ci-forgejo-apt.sh forgejo-deb-repokey_2-1_all.deb

  publish-release-repo:
    runs-on: bookworm
    if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') && github.repository == 'forgejo-contrib/forgejo-deb'
    steps:
      - uses: actions/checkout@v4

      - name: actions prep
        id: ciprep
        run: ./.ci-make.sh actions-prep

      - uses: actions/download-artifact@v3
        with:
          name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}

      - uses: crystal/install-jq-action@v2.1.0
      - run: mkdir forgejo-release
      - run: mv *.deb *.deb.sha256 forgejo-release/
      
      - uses: actions/forgejo-release@v1
        with:
          direction: upload
          url: https://codeberg.org
          token: ${{ secrets.codeberg_api_key }}
          release-dir: forgejo-release

      - uses: actions/forgejo-release@v1
        with:
          direction: upload
          url: https://code.forgejo.org
          token: ${{ secrets.cfo_api_key }}
          release-dir: forgejo-release

      - name: Debian package registry publish
        env:
          FORGEJO_SITE: https://code.forgejo.org
          FORGEJO_OWNER: forgejo-contrib
          DEBIAN_DIST: bullseye
          DEBIAN_COMPONENT: forgejo-lts
          FORGEJO_KEY: ${{ secrets.cfo_api_key }}
        run: |
          cd forgejo-release
          ../.ci-forgejo-apt.sh *.deb
          cd ..