-
Notifications
You must be signed in to change notification settings - Fork 1.9k
68 lines (57 loc) · 2.43 KB
/
build-and-push-containers.yml
File metadata and controls
68 lines (57 loc) · 2.43 KB
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
name: Build and push API & Blazor containers
on:
push:
branches:
- develop
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: docker login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish API container image
working-directory: ${{ github.workspace }}
run: |
dotnet publish src/Playground/Playground.Api/Playground.Api.csproj \
-c Release -r linux-x64 \
-p:PublishProfile=DefaultContainer \
-p:ContainerRepository=ghcr.io/${{ github.repository_owner }}/fsh-playground-api \
-p:ContainerImageTags=${{ github.sha }}
- name: Publish Blazor container image
working-directory: ${{ github.workspace }}
run: |
dotnet publish src/Playground/Playground.Blazor/Playground.Blazor.csproj \
-c Release -r linux-x64 \
-p:PublishProfile=DefaultContainer \
-p:ContainerRepository=ghcr.io/${{ github.repository_owner }}/fsh-playground-blazor \
-p:ContainerImageTags=${{ github.sha }}
- name: Tag images with latest
working-directory: ${{ github.workspace }}
run: |
docker tag ghcr.io/${{ github.repository_owner }}/fsh-playground-api:${{ github.sha }} \
ghcr.io/${{ github.repository_owner }}/fsh-playground-api:latest
docker tag ghcr.io/${{ github.repository_owner }}/fsh-playground-blazor:${{ github.sha }} \
ghcr.io/${{ github.repository_owner }}/fsh-playground-blazor:latest
- name: Push API images to GHCR
working-directory: ${{ github.workspace }}
run: |
docker push ghcr.io/${{ github.repository_owner }}/fsh-playground-api:${{ github.sha }}
docker push ghcr.io/${{ github.repository_owner }}/fsh-playground-api:latest
- name: Push Blazor images to GHCR
working-directory: ${{ github.workspace }}
run: |
docker push ghcr.io/${{ github.repository_owner }}/fsh-playground-blazor:${{ github.sha }}
docker push ghcr.io/${{ github.repository_owner }}/fsh-playground-blazor:latest