-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (101 loc) · 3.73 KB
/
Copy pathci-build.yml
File metadata and controls
118 lines (101 loc) · 3.73 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
types: [ opened, reopened, synchronize ]
workflow_call:
workflow_dispatch:
name: ci-build
env:
REGISTRY: ghcr.io
DOTNET_VERSION: 10.0.x
jobs:
tests:
name: Tests (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: repository-server-tunit
project: RepositoryServer.Tests/RepositoryServer.Tests.csproj
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: '${{ env.DOTNET_VERSION }}'
- name: Run ${{ matrix.name }} tests
run: |
set -euo pipefail
dotnet test -c Release --project ${{ matrix.project }}
build:
name: Build (${{ matrix.image }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dockerfile: docker/RepositoryServer.Dockerfile
image: repository-server
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Log in to Container Registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build ${{ matrix.image }}
uses: ./.github/actions/build-app
with:
dockerfile: ${{ matrix.dockerfile }}
push: ${{ inputs.push || (github.ref_protected && github.event_name != 'pull_request') }}
image: ${{ matrix.image }}
platforms: ${{ inputs.platforms || 'linux/amd64' }}
tag-prefix: ${{ inputs.tag-prefix || 'rn' }}
promote-image:
name: Promote Image (${{ matrix.image }})
needs: [build, tests]
runs-on: ubuntu-latest
if: ${{ inputs.push || (github.ref_protected && github.event_name != 'pull_request') }}
strategy:
fail-fast: false
matrix:
include:
- image: repository-server
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Log in to Container Registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Promote Manifest ${{ matrix.image }}
uses: ./.github/actions/promote-image
with:
image: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.image }}
run-tag: ${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}
latest: ${{ inputs.latest || false }}
deploy-prod-workflow:
runs-on: ubuntu-latest
needs: promote-image
if: ${{ github.ref_type == 'branch' && github.event_name != 'pull_request' && github.ref_name == 'master' }}
environment: production
steps:
- name: Send repository dispatch
uses: OpenShock/actions/repository-dispatch@21ca2d511bca92cf24fb502fa302f82700822584 # v1.1.1
with:
repo: openshock/kubernetes-cluster-gitops
event-type: update-repository-server-prod
client-payload: |
{"tag": "${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"}
token: ${{ secrets.GITOPS_PAT }}