-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (135 loc) · 4.49 KB
/
github-ci.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: GitHub CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build-nugets:
name: 🚀 Pack ${{matrix.projectName}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectName:
- LanguageIdentification.CLD2.Native
- LanguageIdentification.CLD2
- LanguageIdentification.CLD3.Native
- LanguageIdentification.CLD3
- LanguageIdentification.FastText.Native
- LanguageIdentification.FastText
- LanguageIdentification.Whatlang.Native
- LanguageIdentification.Whatlang
permissions:
contents: read
packages: write
env:
ROOT: ./src
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: 📂 Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
5.0.x
6.0.x
7.0.x
8.0.x
source-url: https://nuget.pkg.github.com/${{github.repository_owner}}/index.json
- name: 📂 Files
working-directory: ${{env.ROOT}}
run: ls -R
- name: 🚀 Pack ${{matrix.projectName}}
working-directory: ${{env.ROOT}}/${{matrix.projectName}}
run: dotnet pack -c Release -o out
- uses: actions/upload-artifact@v4
with:
name: build-${{matrix.projectName}}
path: ${{env.ROOT}}/${{matrix.projectName}}/out
retention-days: 1
overwrite: 'true'
compression-level: 0
test-nugets:
name: 🧪 Test ${{matrix.projectName}}
runs-on: ubuntu-latest
needs: build-nugets
permissions:
contents: read
packages: write
env:
ROOT: ./src
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: build-*
merge-multiple: true
path: ${{env.ROOT}}/local-nugets
- name: 📂 Files
working-directory: ${{env.ROOT}}
run: ls -R
- name: 📂 Build Docker Image \#1
working-directory: ${{env.ROOT}}
run: docker build -f ./test.Dockerfile -t local-dotnet-test-sdk:latest .
- name: 📂 Build Docker Image \#2
working-directory: ${{env.ROOT}}
run: docker build -f ./test-ci.Dockerfile -t local-dotnet-test-ci-sdk:latest .
- name: 🧪 Test
working-directory: ${{env.ROOT}}
run: docker run --rm -v $(pwd):/src local-dotnet-test-ci-sdk:latest
deploy-nugets:
name: 🚚 Push ${{matrix.projectName}}
runs-on: ubuntu-latest
needs: test-nugets
if: github.ref == 'refs/heads/master'
strategy:
fail-fast: false
matrix:
projectName:
- LanguageIdentification.CLD2.Native
- LanguageIdentification.CLD2
- LanguageIdentification.CLD3.Native
- LanguageIdentification.CLD3
- LanguageIdentification.FastText.Native
- LanguageIdentification.FastText
- LanguageIdentification.Whatlang.Native
- LanguageIdentification.Whatlang
permissions:
contents: read
packages: write
env:
ROOT: ./src
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MICROSOFT_NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_WRITE_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: build-${{matrix.projectName}}
path: ${{env.ROOT}}/${{matrix.projectName}}/out
- name: 📂 Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
5.0.x
6.0.x
7.0.x
8.0.x
source-url: https://nuget.pkg.github.com/${{github.repository_owner}}/index.json
- name: 📂 Files
working-directory: ${{env.ROOT}}
run: ls -R
- name: 🚚 Push ${{matrix.projectName}} to GitHub registry
working-directory: ${{env.ROOT}}/${{matrix.projectName}}
run: dotnet nuget push ./out/**/*.nupkg --skip-duplicate -k ${{env.NUGET_AUTH_TOKEN}} --source https://nuget.pkg.github.com/${{github.repository_owner}}/index.json
# - name: 🚚 Push ${{matrix.projectName}} to Microsoft registry
# working-directory: ${{env.ROOT}}/${{matrix.projectName}}
# run: dotnet nuget push ./out/**/*.nupkg --skip-duplicate -k ${{env.MICROSOFT_NUGET_AUTH_TOKEN}} --source https://api.nuget.org/v3/index.json
- uses: geekyeggo/delete-artifact@v5
with:
name: build-${{matrix.projectName}}