forked from OctopusSamples/RandomQuotes-K8s
-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (64 loc) · 2.55 KB
/
build.yml
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
name: Build Container
on:
push:
branches:
- main
- 'feature/**'
paths:
- 'src/**'
- '.github/**'
pull_request:
types:
- opened
- reopened
- synchronize
paths:
- 'src/**'
- '.github/**'
workflow_dispatch:
jobs:
build-and-push-application:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['8.0.x']
steps:
- uses: actions/checkout@v1
with:
fetch-depth: '0'
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x
- id: determine_version
name: Determine Version
uses: gittools/actions/gitversion/[email protected]
with:
additionalArguments: /overrideconfig mode=Mainline
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_PAT_USERNAME }}
password: ${{ secrets.DOCKERHUB_PAT }}
- name: install buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: build and push website container
working-directory: src
run: |
docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7 -f "./RandomQuotes.Web/Dockerfile" --build-arg APP_VERSION=${{ steps.determine_version.outputs.semVer }} --tag bobjwalker99/randomquotes-k8s:${{ steps.determine_version.outputs.semVer }} --tag bobjwalker99/randomquotes-k8s:latest .
- name: update dev kustomize
uses: mikefarah/yq@master
with:
cmd: yq -i 'images.[0].newTag="${{ steps.determine_version.outputs.semVer }}"' 'k8s/overlays/dev/kustomization.yaml'
- name: commit the kustomize change
uses: devops-infra/action-commit-push@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
commit_message: "Updating the dev Kustomize overlay to ${{ steps.determine_version.outputs.semVer }}"