This repository has been archived by the owner on Dec 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
## 更新内容 | ||
+ 添加 GitHub Actions 自动构建 Docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" ] |