-
Notifications
You must be signed in to change notification settings - Fork 2
140 lines (138 loc) · 4.81 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
# Copyright (c) 2023 Contributors to the Suwayomi project
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Build
on:
push:
branches: ['Release']
defaults:
run:
shell: bash
jobs:
GenTag:
outputs:
value: ${{steps.GenTagName.outputs.value}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate Tag Name
id: GenTagName
run: |
genTag="r$(git rev-list HEAD --count)"
echo "$genTag"
echo "value=$genTag" >> $GITHUB_OUTPUT
build:
needs: GenTag
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Use bun 1.0.18
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install bun dependencies
run: bun i
- run: bun run build
- run: echo "${{ needs.GenTag.outputs.value }}" > ./build/revision
- run: sed -i "s@BUILD_VERSION_PLACEHOLDER@${{ needs.GenTag.outputs.value }}@" ./build/index.html
- run: bun run build-md5
- uses: actions/upload-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}
path: ./build/
- uses: actions/upload-artifact@v4
with:
name: build-md5-${{ needs.GenTag.outputs.value }}
path: ./buildZip/md5sum
web:
needs:
- build
- GenTag
runs-on: ubuntu-latest
steps:
- name: get Build files
uses: actions/download-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}
path: ./build
- name: get md5
uses: actions/download-artifact@v4
with:
name: build-md5-${{ needs.GenTag.outputs.value }}
path: ./buildZip/md5sum
- name: Generate zip
working-directory: ./build
run: zip -r Suwayomi-VUI-Web.zip ./*
- name: Create release
uses: actions/create-release@v1
id: create_release
with:
tag_name: ${{ needs.GenTag.outputs.value }}
release_name: ${{ needs.GenTag.outputs.value }}
body: ''
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/Suwayomi-VUI-Web.zip
asset_name: Suwayomi-VUI-Web-${{ needs.GenTag.outputs.value }}.zip
asset_content_type: application/zip
- name: Upload md5
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./buildZip/md5sum
asset_name: md5sum
asset_content_type: text/plain
docker:
needs:
- build
- GenTag
runs-on: ubuntu-latest
steps:
- name: get Build files
uses: actions/download-artifact@v4
with:
name: build-files-${{ needs.GenTag.outputs.value }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: string
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.repository_owner }}/${{ github.event.repository.name }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64, linux/386, linux/ppc64le, linux/s390x
context: .
build-args: version=${{ needs.GenTag.outputs.value }}
push: true
tags: |
ghcr.io/${{ steps.string.outputs.lowercase }}:latest,
ghcr.io/${{ steps.string.outputs.lowercase }}:${{ needs.GenTag.outputs.value }},
${{ steps.string.outputs.lowercase }}:latest,
${{ steps.string.outputs.lowercase }}:${{ needs.GenTag.outputs.value }},