Skip to content
This repository was archived by the owner on Dec 25, 2023. It is now read-only.

Commit ca06324

Browse files
committed
添加 GitHub Actions 自动构建 Docker
1 parent d2b1fad commit ca06324

4 files changed

Lines changed: 69 additions & 4 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish Docker
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Push events to every tag not containing /
7+
8+
# Pattern matched against refs/tags
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set env
16+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
17+
- name: Test
18+
run: |
19+
echo $RELEASE_VERSION
20+
echo ${{ env.RELEASE_VERSION }}
21+
- name: Setup .NET
22+
uses: actions/setup-dotnet@v1
23+
with:
24+
dotnet-version: 6.0.x
25+
- name: Restore dependencies
26+
run: dotnet restore CheapSteam.UI/CheapSteam.UI/CheapSteam.UI.csproj
27+
- name: Publish Linux x64
28+
run: dotnet publish CheapSteam.UI/CheapSteam.UI/CheapSteam.UI.csproj --runtime linux-x64 -p:PublishSingleFile=true --self-contained true -o ./CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64 -c Release
29+
- name: Edit default listen url
30+
run: sed -i 's/127.0.0.1/0.0.0.0/g' ./CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64/appsettings.json
31+
- name: Zip files
32+
run: zip -r CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64.zip ./CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64
33+
- name: Copy bin files
34+
run: cp CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64.zip docker/
35+
-
36+
name: Set up QEMU
37+
uses: docker/setup-qemu-action@v2
38+
-
39+
name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@v2
41+
-
42+
name: Login to DockerHub
43+
uses: docker/login-action@v2
44+
with:
45+
username: ${{ secrets.DOCKERHUB_USERNAME }}
46+
password: ${{ secrets.DOCKERHUB_TOKEN }}
47+
-
48+
name: Edit default dockerfile
49+
run: sed -i 's/RELEASE_VERSION/${{ env.RELEASE_VERSION }}/g' docker/dockerfile
50+
-
51+
name: Build and push
52+
uses: docker/build-push-action@v3
53+
with:
54+
push: true
55+
tags: sayokurisu/cheapsteam:latest,sayokurisu/cheapsteam:${{ env.RELEASE_VERSION }}
56+
context: docker

Changelog/v2.1.1-changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## 更新内容
2+
+ 添加 GitHub Actions 自动构建 Docker

Docs/Deploy.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
`v2.1.0` 版本后添加了验证模块,您可以在服务器部署 CheapSteam。
44
此种方式的优点在于你无需通过特殊手段访问 Steam 市场(假定您部署在海外服务器上),而且对市场的爬取速度较为理想。
55
## 下载
6+
### 直接运行
67
通过 [发布页](https://github.com/YukiCoco/CheapSteam/releases) 下载适用于 Linux 的程序,然后解压到任意位置。
8+
### 使用 Docker
9+
e.g. `docker container run -d -p 8888:1272 sayokurisu/cheapsteam:v2.1.0`
10+
将 v2.1.0 的 CheapSteam 运行在 8888 端口上,此时可通过 HTTP 8888 端口直接访问
11+
**进入程序后请在设置页面勾选 `开启网页验证`**
712
## 部署
813
### 反向代理
914
将下列配置文件添加到 nginx 的配置中,一般路径为 `/etc/nginx/sites-enabled/`
@@ -47,5 +52,7 @@ Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
4752
WantedBy=multi-user.target
4853
````
4954
`systemctl start cheapsteam` 开启运行 CheapSteam
55+
## 设置
56+
**进入程序后请在设置页面勾选 `开启网页验证`**
5057
## 完成
5158
此时可以访问你的域名进入程序

docker/dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
FROM bitnami/aspnet-core:6.0.8-debian-11-r3
22

3-
COPY CheapSteam-v2.1.0-linux-x64.zip /app/
3+
COPY CheapSteam-RELEASE_VERSION-linux-x64.zip /app/
44
WORKDIR /app
55

66
RUN apt-get update \
77
&& apt-get install -y unzip \
8-
&& unzip CheapSteam-v2.1.0-linux-x64.zip \
9-
&& chmod 755 /app/CheapSteam-v2.1.0-linux-x64/CheapSteam.UI
8+
&& unzip CheapSteam-RELEASE_VERSION-linux-x64.zip \
9+
&& chmod 755 /app/CheapSteam-RELEASE_VERSION-linux-x64/CheapSteam.UI
1010

11-
WORKDIR /app/CheapSteam-v2.1.0-linux-x64
11+
WORKDIR /app/CheapSteam-RELEASE_VERSION-linux-x64
1212

1313
CMD [ "./CheapSteam.UI" ]

0 commit comments

Comments
 (0)