-
Notifications
You must be signed in to change notification settings - Fork 7
100 lines (83 loc) · 2.83 KB
/
build-image.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
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
name: Build image
on:
workflow_call:
inputs:
build-target:
required: true
type: string
image-file: #ar-acm-api-image.tar
required: true
type: string
image-name: #acm-api
required: true
type: string
build-project:
required: true
type: string
semver:
required: true
type: string
jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Check version
shell: bash
run: echo $SEMVER
env:
SEMVER: ${{ inputs.semver }}
- name: Checkout Code
uses: actions/checkout@v3
- name: Parse repository name
run: echo REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//") >> $GITHUB_ENV
shell: bash
- name: Setup .NET Core
uses: ./.github/actions/setup-dotnet
with:
version: ${{ secrets.VBR_DOTNET_VERSION }}
- name: Setup nodejs
uses: ./.github/actions/setup-nodejs
- name: Dotnet restore
shell: bash
run: dotnet restore src/${{ inputs.build-project }} --runtime linux-x64
- name: Set solution info
shell: bash
if: inputs.semver != 'none'
run: CI_BUILD_NUMBER=$SEMVER ./build.sh SetSolutionInfo
env:
BUILD_DOCKER_REGISTRY: ${{ secrets.VBR_DEVOPS_DOCKER_REGISTRY }}
SEMVER: ${{ inputs.semver }}
- name: Dotnet build
shell: bash
run: |
dotnet build --no-restore --os linux --arch x64 --self-contained true -f net6.0 src/${{ inputs.build-project }}/${{ inputs.build-project }}.csproj
- name: Dotnet publish
shell: bash
run: dotnet publish -o dist/${{ inputs.build-project }}/linux --no-build --no-restore --runtime 'linux-x64' --self-contained -f net6.0 src/${{ inputs.build-project }}
- name: Containerize
shell: bash
run: CI_BUILD_NUMBER=$SEMVER ./build.sh ${{ inputs.build-target }}
env:
BUILD_DOCKER_REGISTRY: ${{ secrets.VBR_DEVOPS_DOCKER_REGISTRY }}
SEMVER: ${{ inputs.semver }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Show images
shell: bash
run: docker images
- name: Save Image
if: inputs.semver != 'none'
shell: bash
run: docker image save $BUILD_DOCKER_REGISTRY/organisation-registry/${{ inputs.image-name }}:$SEMVER -o ~/${{ inputs.image-file}}
env:
BUILD_DOCKER_REGISTRY: ${{ secrets.VBR_DEVOPS_DOCKER_REGISTRY }}
SEMVER: ${{ inputs.semver }}
- name: Upload artifact
if: inputs.semver != 'none'
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.image-name }}
path: ~/${{ inputs.image-file }}
- name: Debug output
shell: bash
run: |
ls -al