Skip to content

Commit d18089e

Browse files
committed
feat. Publish docker container to github registry
1 parent cce6842 commit d18089e

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

.github/workflows/deploy.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,12 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
- name: Setup .NET
14-
uses: actions/setup-dotnet@v4
13+
- name: Log in to GitHub Container Registry
14+
uses: docker/login-action@v3
1515
with:
16-
dotnet-version: 8.0.x
17-
- name: Publish
18-
run: dotnet publish dotpaste/dotpaste.csproj -c Release -o build
19-
- name: Upload to server
20-
uses: ErSoul/[email protected]
21-
with:
22-
host: ${{vars.SSH_HOST}}
23-
username: ${{secrets.SSH_USER}}
24-
key: ${{secrets.SSH_KEY}}
25-
source: ./build/*
26-
target: /srv/dotpaste
27-
after: systemctl --user restart dotpaste
16+
registry: ghcr.io
17+
username: ${{ github.actor }}
18+
password: ${{ secrets.GITHUB_TOKEN }}
19+
- name: Build and Publish
20+
run: |
21+
dotnet publish --os linux --arch x64 /t:PublishContainer -p ContainerTag=$(git describe --tags --always)

dotpaste/dotpaste.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@
77

88
<PropertyGroup>
99
<ContainerBaseImage>mcr.microsoft.com/dotnet/aspnet:8.0-alpine-composite</ContainerBaseImage>
10+
<ContainerRegistry>ghcr.io</ContainerRegistry>
11+
<ContainerRepository>ErSoul/dotpaste</ContainerRepository>
1012
</PropertyGroup>
1113
</Project>

0 commit comments

Comments
 (0)