diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml new file mode 100644 index 0000000..2b39fa3 --- /dev/null +++ b/.github/workflows/publish-docker.yml @@ -0,0 +1,56 @@ +name: Publish Docker + +on: + push: + tags: + - 'v*' # Push events to every tag not containing / + + # Pattern matched against refs/tags +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Test + run: | + echo $RELEASE_VERSION + echo ${{ env.RELEASE_VERSION }} + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore CheapSteam.UI/CheapSteam.UI/CheapSteam.UI.csproj + - name: Publish Linux x64 + 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 + - name: Edit default listen url + run: sed -i 's/127.0.0.1/0.0.0.0/g' ./CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64/appsettings.json + - name: Zip files + run: zip -r CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64.zip ./CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64 + - name: Copy bin files + run: cp CheapSteam-${{ env.RELEASE_VERSION }}-linux-x64.zip docker/ + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Edit default dockerfile + run: sed -i 's/RELEASE_VERSION/${{ env.RELEASE_VERSION }}/g' docker/dockerfile + - + name: Build and push + uses: docker/build-push-action@v3 + with: + push: true + tags: sayokurisu/cheapsteam:latest,sayokurisu/cheapsteam:${{ env.RELEASE_VERSION }} + context: docker \ No newline at end of file diff --git a/Changelog/v2.1.1-changelog.md b/Changelog/v2.1.1-changelog.md new file mode 100644 index 0000000..e7cf117 --- /dev/null +++ b/Changelog/v2.1.1-changelog.md @@ -0,0 +1,2 @@ +## 更新内容 ++ 添加 GitHub Actions 自动构建 Docker \ No newline at end of file diff --git a/Docs/Deploy.md b/Docs/Deploy.md index ba6d5ad..371e998 100644 --- a/Docs/Deploy.md +++ b/Docs/Deploy.md @@ -3,7 +3,12 @@ `v2.1.0` 版本后添加了验证模块,您可以在服务器部署 CheapSteam。 此种方式的优点在于你无需通过特殊手段访问 Steam 市场(假定您部署在海外服务器上),而且对市场的爬取速度较为理想。 ## 下载 +### 直接运行 通过 [发布页](https://github.com/YukiCoco/CheapSteam/releases) 下载适用于 Linux 的程序,然后解压到任意位置。 +### 使用 Docker +e.g. `docker container run -d -p 8888:1272 sayokurisu/cheapsteam:v2.1.0` +将 v2.1.0 的 CheapSteam 运行在 8888 端口上,此时可通过 HTTP 8888 端口直接访问 +**进入程序后请在设置页面勾选 `开启网页验证`** ## 部署 ### 反向代理 将下列配置文件添加到 nginx 的配置中,一般路径为 `/etc/nginx/sites-enabled/` @@ -47,5 +52,7 @@ Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false WantedBy=multi-user.target ```` `systemctl start cheapsteam` 开启运行 CheapSteam +## 设置 +**进入程序后请在设置页面勾选 `开启网页验证`** ## 完成 此时可以访问你的域名进入程序 \ No newline at end of file diff --git a/docker/dockerfile b/docker/dockerfile index 2557398..4cf5a67 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -1,13 +1,13 @@ FROM bitnami/aspnet-core:6.0.8-debian-11-r3 -COPY CheapSteam-v2.1.0-linux-x64.zip /app/ +COPY CheapSteam-RELEASE_VERSION-linux-x64.zip /app/ WORKDIR /app RUN apt-get update \ && apt-get install -y unzip \ - && unzip CheapSteam-v2.1.0-linux-x64.zip \ - && chmod 755 /app/CheapSteam-v2.1.0-linux-x64/CheapSteam.UI + && unzip CheapSteam-RELEASE_VERSION-linux-x64.zip \ + && chmod 755 /app/CheapSteam-RELEASE_VERSION-linux-x64/CheapSteam.UI -WORKDIR /app/CheapSteam-v2.1.0-linux-x64 +WORKDIR /app/CheapSteam-RELEASE_VERSION-linux-x64 CMD [ "./CheapSteam.UI" ] \ No newline at end of file