-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (110 loc) · 3.4 KB
/
release.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
name: RELEASE
on:
push:
branches:
- dev
tags:
- '*'
pull_request:
types:
- opened
- synchronize
jobs:
tests:
name: Tests
strategy:
matrix:
os: [ ubuntu-latest ]
scala: [ 2.12.7 ]
java: [ adopt@1.8 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java and Scala
uses: olafurpg/setup-scala@v10
with:
java-version: ${{ matrix.java }}
- name: Cache sbt
uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: Runs tests
run: |
sbt ++${{ matrix.scala }} test
export-data:
name: export chain data
permissions: write-all
if: github.event_name != 'pull_request'
needs: tests
strategy:
matrix:
os: [ ubuntu-latest ]
scala: [ 2.12.7 ]
java: [ adopt@1.8 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java and Scala
uses: olafurpg/setup-scala@v13
with:
java-version: ${{ matrix.java }}
- name: Cache sbt
uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: Build App
run: |
sbt ++${{ matrix.scala }} assembly
- name: RUN Jar File for push to master
if: github.ref_type == 'branch'
id: set-version
run: |
VERSION_STRING=$(sbt -Dsbt.supershell=false -error "print version")
APP_VERSION_STRING=$(echo "${VERSION_STRING:0:5}")-$(git rev-parse --short HEAD)
echo APP_VERSION=$APP_VERSION_STRING >> "$GITHUB_OUTPUT"
ROSEN=$(find . -name 'contract-rosen-bridge-*.jar')
java -jar $ROSEN all --version $APP_VERSION_STRING
- name: Upload JSON files
uses: softprops/action-gh-release@v1
if: github.ref_type == 'branch'
with:
tag_name: ${{ steps.set-version.outputs.APP_VERSION }}
prerelease: true
files: |
contracts-*.json
tokensMap-*.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: git-sync
uses: wei/git-sync@v3
with:
source_repo: ${GITHUB_REPOSITORY}
source_branch: "refs/tags/*"
destination_repo: 'https://${{ secrets.DESTINATION_USER }}:${{ secrets.DESTINATION_TOKEN }}@${{ secrets.DESTINATION_SERVER }}/ergo/${GITHUB_REPOSITORY}.git'
destination_branch: "refs/tags/*"
- name: RUN Jar File release
if: github.ref_type == 'tag'
run: |
ROSEN=$(find . -name 'contract-rosen-bridge-*.jar')
java -jar $ROSEN all --version ${{ github.ref_name }}
- name: Upload JSON files
uses: softprops/action-gh-release@v1
if: github.ref_type == 'tag'
with:
files: |
contracts-*.json
tokensMap-*.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}