-
Notifications
You must be signed in to change notification settings - Fork 8
129 lines (129 loc) · 4.63 KB
/
actions.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
on:
push:
paths-ignore:
- "**/*.md"
pull_request:
workflow_dispatch:
env:
NODE_VERSION: 20
NPM_REGISTRY: https://registry.npmjs.org
jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
es-version: [6.8.20, 7.17.4]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: ${{ env.NPM_REGISTRY }}
- name: Install yarn
run: corepack enable && corepack prepare [email protected] --activate
- name: Install node dependencies
run: corepack yarn --cwd cassandra-distributed-task-queue-ui --immutable
- name: Restore dotnet tools
run: dotnet tool restore
- name: Build dotnet
run: dotnet build --configuration Release --verbosity minimal
- name: Build front
run: yarn --cwd cassandra-distributed-task-queue-ui build
- name: Check C# code style
run: dotnet jb cleanupcode Cassandra.DistributedTaskQueue.sln --profile=CatalogueCleanup --verbosity=WARN && git diff --exit-code -- ':!./cassandra-distributed-task-queue-ui/.yarn'
- name: Check front code
run: yarn --cwd cassandra-distributed-task-queue-ui lint
- name: Build docker-compose environment
run: docker-compose -f docker-compose.yaml up -d --build
env:
ES_VERSION: ${{ matrix.es-version }}
- name: Run front tests
run: yarn --cwd cassandra-distributed-task-queue-ui test
- name: Run tests
run: dotnet test --no-build --configuration Release
env:
ES_VERSION: ${{ matrix.es-version }}
- name: Stop docker-compose
if: always()
run: docker-compose -f docker-compose.yaml down
env:
ES_VERSION: ${{ matrix.es-version }}
publish:
runs-on: ubuntu-20.04
needs: test
if: startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: ${{ env.NPM_REGISTRY }}
- name: Install node dependencies
run: yarn --cwd cassandra-distributed-task-queue-ui install --frozen-lockfile
- name: Restore dotnet tools
run: dotnet tool restore
- name: Build dotnet
run: dotnet build --configuration Release --verbosity minimal
- name: Check version
run: |
tagName="${{github.ref_name}}"
echo "Will publish nuget package for $tagName tag"
# tag name starts with 'vX.Y-release' (e.g. use 'v4.2-release.1' tag for the first patch for release v4.2)
if [[ $tagName =~ v([0-9]+\.[0-9]+)-release ]] ; then
releaseVersion=${BASH_REMATCH[1]}
echo "SHOULD_CREATE_RELEASE=true" >> $GITHUB_ENV
else
releaseVersion="${tagName:1}"
fi
echo "Will create release $releaseVersion for $tagName tag"
if ! grep -Fq "\"version\": \"$releaseVersion\"" ./version.json ; then
echo "Version in tag ($releaseVersion) does not match version in version.json"
exit 1
fi
- name: Pack dotnet
run: dotnet pack --no-build --configuration Release --output out
- name: Build front
run: yarn --cwd cassandra-distributed-task-queue-ui build
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: |
**/*.nupkg
**/*.tgz
if-no-files-found: error
- name: Publish NuGet
run: dotnet nuget push "**/*.nupkg" --source https://api.nuget.org/v3/index.json --no-symbols --api-key ${{ env.NUGET_API_KEY }}
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
- name: Publish NPM
run: |
for file in ./cassandra-distributed-task-queue-ui/dist/*.tgz; do
echo "Will publish $file"
npm publish $file --ignore-scripts
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create release
uses: softprops/action-gh-release@v1
if: ${{ env.SHOULD_CREATE_RELEASE == 'true' }}
with:
fail_on_unmatched_files: true
draft: false
prerelease: false
files: |
**/*.nupkg
**/*.tgz