-
Notifications
You must be signed in to change notification settings - Fork 490
133 lines (116 loc) · 4.36 KB
/
build-release.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
name: Build + Release
on:
push:
branches:
- 'master'
jobs:
test:
runs-on: ubuntu-latest
# Only run if the commit message contains the string [build]
if: contains(github.event.head_commit.message, '[build]')
steps:
- uses: actions/checkout@v4
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Unit and integration tests
run: dotnet test
build:
runs-on: ubuntu-latest
needs: test
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Read the version
- name: Read version
run: echo "VERSION=$(head -n 1 OpenBullet2.Web/version.txt)" >> $GITHUB_ENV
# Build using docker
- name: Build using docker
run: docker build -t openbullet2-build -f Dockerfile.build .
# Extract files from the /app folder of the image into a zip
- name: Extract files from the image
run: |
docker run --name openbullet2-extract openbullet2-build echo "Extracting files"
docker cp openbullet2-extract:/app/web .web
docker cp openbullet2-extract:/app/native .native
docker cp openbullet2-extract:/app/updater .updater
docker rm openbullet2-extract
mkdir .release
cd .web
zip -r ../.release/OpenBullet2.Web.zip ./*
cd ../.native
zip -r ../.release/OpenBullet2.Native.zip ./*
cd ..
mv .updater/web/win-x64/OpenBullet2.Web.Updater.exe .release/ob2-web-updater-win-x64.exe
mv .updater/web/win-x86/OpenBullet2.Web.Updater.exe .release/ob2-web-updater-win-x86.exe
mv .updater/web/win-arm64/OpenBullet2.Web.Updater.exe .release/ob2-web-updater-win-arm64.exe
mv .updater/web/linux-x64/OpenBullet2.Web.Updater .release/ob2-web-updater-linux-x64
mv .updater/web/linux-arm64/OpenBullet2.Web.Updater .release/ob2-web-updater-linux-arm64
mv .updater/native/win-x64/OpenBullet2.Native.Updater.exe .release/ob2-native-updater-win-x64.exe
mv .updater/native/win-x86/OpenBullet2.Native.Updater.exe .release/ob2-native-updater-win-x86.exe
mv .updater/native/win-arm64/OpenBullet2.Native.Updater.exe .release/ob2-native-updater-win-arm64.exe
# Upload the files to the release
- name: Upload OpenBullet2 release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: '.release/*'
file_glob: true
release_name: ${{ env.VERSION }}
tag: ${{ env.VERSION }}
overwrite: false
prerelease: false
make_latest: true
# Show ONLY the commit description in the release (without)
body: |
This is a **RELEASE** build.
Please refer to [this guide](https://discourse.openbullet.dev/t/how-to-download-and-start-openbullet-2/29) for the download instructions.
- name: Notify new build on discord
if: success()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_EMBEDS: |
[
{
"title": "New release build",
"description": "Release **${{ env.VERSION }}** available",
"color": 5763719
}
]
uses: Ilshidur/action-discord@master
- name: Setup upterm session
uses: lhotari/action-upterm@v1
if: ${{ failure() }}
with:
## If no one connects after 5 minutes, shut down server.
wait-timeout-minutes: 5
docker:
name: Build and Push Docker image to Docker Hub
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# Read the version
- name: Read version
run: echo "VERSION=$(cat OpenBullet2.Web/version.txt)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
file: ./Dockerfile.remote
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
tags: openbullet/openbullet2:latest,openbullet/openbullet2:${{ env.VERSION }}