-
Notifications
You must be signed in to change notification settings - Fork 22
157 lines (129 loc) · 5.92 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
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
155
156
157
name: Build and Release Binaries
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [ windows-latest, ubuntu-latest, macos-latest ]
include:
- os: windows-latest
extension: ".zip"
runtime: "win-x64"
- os: ubuntu-latest
extension: ".tar.gz"
runtime: "linux-x64"
- os: macos-latest
runtime: "osx-x64"
extension: ".zip"
node_version: [18]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
PROJECT_NAME: 'Blockcore.Indexer'
SOLUTION_PATH: 'Blockcore.Indexer.sln'
PROJECT_PATH: 'src/Blockcore.Indexer/Blockcore.Indexer.csproj'
CIRRUS_NAME: 'Blockcore.Indexer.Cirrus'
CIRRUS_PATH: 'src/Blockcore.Indexer.Cirrus/Blockcore.Indexer.Cirrus.csproj'
ANGOR_NAME: 'Blockcore.Indexer.Angor'
ANGOR_PATH: 'src/Blockcore.Indexer.Angor/Blockcore.Indexer.Angor.csproj'
BUILD_CONFIGURATION: 'Release'
steps:
- uses: actions/checkout@v1
name: Checkout
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
8.0.x
- name: Setup Node.js (${{ matrix.node_version }})
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}
- name: Variables
run: |
echo VERSION=$(npm run version --silent) >> $GITHUB_ENV
shell: bash
# - name: Variables
# run: |
# echo "::set-env name=VERSION::$(npm run version --silent)"
# echo "::set-env name=RELEASE_CONFIGURATION::${{ matrix.runtime }}"
# - name: Setup .NET Core (${{ matrix.dotnet_version }})
# uses: actions/setup-dotnet@v1
# with:
# dotnet-version: ${{ matrix.dotnet_version }}
- name: Restore
run: dotnet restore ${{env.SOLUTION_PATH}}
- name: Unit Test
run: dotnet test -v=normal -c ${{env.BUILD_CONFIGURATION}}
# - name: Build
# run: dotnet build -c ${{env.BUILD_CONFIGURATION}} -r ${{env.RELEASE_CONFIGURATION}} /p:Version=${{ env.VERSION }} -v m ${{env.SOLUTION_PATH}}
- name: Publish (Blockcore Indexer)
run: dotnet publish -c ${{env.BUILD_CONFIGURATION}} -r ${{matrix.runtime}} /p:Version=${{ env.VERSION }} -v m -o ./src/${{ env.PROJECT_NAME }}/bin/publish ${{env.PROJECT_PATH}}
- name: Publish (Cirrus Indexer)
run: dotnet publish -c ${{env.BUILD_CONFIGURATION}} -r ${{matrix.runtime}} /p:Version=${{ env.VERSION }} -v m -o ./src/${{ env.CIRRUS_NAME }}/bin/publish ${{env.CIRRUS_PATH}}
- name: Publish (Angor Indexer)
run: dotnet publish -c ${{env.BUILD_CONFIGURATION}} -r ${{matrix.runtime}} /p:Version=${{ env.VERSION }} -v m -o ./src/${{ env.ANGOR_NAME }}/bin/publish ${{env.ANGOR_PATH}}
- name: Package Name
run: |
echo RELEASE_NAME=${{ env.PROJECT_NAME }}-${{ env.VERSION }}-${{ matrix.runtime }}${{ matrix.extension }} >> $GITHUB_ENV
echo RELEASE_PATH=${{ env.PROJECT_NAME }}-${{ env.VERSION }}-${{ matrix.runtime }}${{ matrix.extension }} >> $GITHUB_ENV
echo RELEASE_CIRRUS_NAME=${{ env.CIRRUS_NAME }}-${{ env.VERSION }}-${{ matrix.runtime }}${{ matrix.extension }} >> $GITHUB_ENV
echo RELEASE_CIRRUS_PATH=${{ env.CIRRUS_NAME }}-${{ env.VERSION }}-${{ matrix.runtime }}${{ matrix.extension }} >> $GITHUB_ENV
echo RELEASE_ANGOR_NAME=${{ env.ANGOR_NAME }}-${{ env.VERSION }}-${{ matrix.runtime }}${{ matrix.extension }} >> $GITHUB_ENV
echo RELEASE_ANGOR_PATH=${{ env.ANGOR_NAME }}-${{ env.VERSION }}-${{ matrix.runtime }}${{ matrix.extension }} >> $GITHUB_ENV
shell: bash
- name: Package (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
echo RELEASE_PATH=./src/${{env.PROJECT_NAME}}/bin/publish/${{env.RELEASE_NAME}} >> $GITHUB_ENV
cd ./src/${{env.PROJECT_NAME}}/bin/publish/
tar cvzf ${{env.RELEASE_NAME}} *
cd ../../../../
echo RELEASE_CIRRUS_PATH=./src/${{env.CIRRUS_NAME}}/bin/publish/${{env.RELEASE_CIRRUS_NAME}} >> $GITHUB_ENV
cd ./src/${{env.CIRRUS_NAME}}/bin/publish/
tar cvzf ${{env.RELEASE_CIRRUS_NAME}} *
cd ../../../../
echo RELEASE_ANGOR_PATH=./src/${{env.ANGOR_NAME}}/bin/publish/${{env.RELEASE_ANGOR_NAME}} >> $GITHUB_ENV
cd ./src/${{env.ANGOR_NAME}}/bin/publish/
tar cvzf ${{env.RELEASE_ANGOR_NAME}} *
- name: Package (Windows)
if: matrix.os == 'windows-latest'
run: |
Compress-Archive -Path .\src\${{env.PROJECT_NAME}}\bin\publish\* -DestinationPath .\${{env.RELEASE_NAME}}
Compress-Archive -Path .\src\${{env.CIRRUS_NAME}}\bin\publish\* -DestinationPath .\${{env.RELEASE_CIRRUS_NAME}}
Compress-Archive -Path .\src\${{env.ANGOR_NAME}}\bin\publish\* -DestinationPath .\${{env.RELEASE_ANGOR_NAME}}
- name: Package (Mac)
if: matrix.os == 'macos-latest'
run: |
zip -r ${{env.RELEASE_NAME}} ./src/${{env.PROJECT_NAME}}/bin/publish/
zip -r ${{env.RELEASE_CIRRUS_NAME}} ./src/${{env.CIRRUS_NAME}}/bin/publish/
zip -r ${{env.RELEASE_ANGOR_NAME}} ./src/${{env.ANGOR_NAME}}/bin/publish/
#- run: mkdir -p path/to/artifact
#- run: echo hello > path/to/artifact/world.txt
- uses: actions/upload-artifact@v1
with:
name: blockcore-indexer
path: "${{env.RELEASE_PATH}}"
- uses: actions/upload-artifact@v1
with:
name: blockcore-cirrus-indexer
path: "${{env.RELEASE_CIRRUS_PATH}}"
- uses: actions/upload-artifact@v1
with:
name: blockcore-angor-indexer
path: "${{env.RELEASE_ANGOR_PATH}}"
- name: Release
uses: sondreb/action-release@main
with:
commit: 'master'
token: ${{ secrets.GITHUB_TOKEN }}
files: "${{env.RELEASE_PATH}};${{env.RELEASE_CIRRUS_PATH}};${{env.RELEASE_ANGOR_PATH}}"
draft: true
prerelease: false
body: ''
name: "Blockcore Indexer (Release ${{env.VERSION}})"
tag: ${{env.VERSION}}