-
Notifications
You must be signed in to change notification settings - Fork 6
151 lines (130 loc) · 4.15 KB
/
Copy pathrelease.yml
File metadata and controls
151 lines (130 loc) · 4.15 KB
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
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-distribution: [ temurin ]
java: [ 8 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: ${{ matrix.java-distribution }}
java-version: ${{ matrix.java }}
cache: 'sbt'
- name: Setup sbt launcher
uses: sbt/setup-sbt@v1
- 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-distribution: [ adopt ]
java: [ 8 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: ${{ matrix.java-distribution }}
java-version: ${{ matrix.java }}
cache: 'sbt'
- name: Setup sbt launcher
uses: sbt/setup-sbt@v1
- name: Setup Node.js for npm publish
uses: actions/setup-node@v6
with:
node-version: 22.18
registry-url: https://registry.npmjs.org/
- name: Build App
run: |
sbt ++${{ matrix.scala }} assembly
- name: RUN Jar File for push to dev
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: RUN Jar File release
if: github.ref_type == 'tag'
run: |
ROSEN=$(find . -name 'contract-rosen-bridge-*.jar')
java -jar "$ROSEN" all
- name: Create TS package tarballs
working-directory: ./ts-packages
run: |
mkdir -p ../release-artifacts/ts-packages
for package_dir in *; do
tar -czf "../release-artifacts/ts-packages/$package_dir.tar.gz" "$package_dir"
done
- name: Publish TS packages to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ "${{ github.ref_type }}" = "branch" ]; then
NPM_TAG="--tag develop"
fi
for package_dir in ts-packages/*; do
npm publish "./$package_dir" --access public $NPM_TAG
done
- name: Upload JSON and TS package files for dev prerelease
uses: softprops/action-gh-release@v3
if: github.ref_type == 'branch'
with:
tag_name: ${{ steps.set-version.outputs.APP_VERSION }}
prerelease: true
files: |
contracts-*.json
tokensMap-*.json
release-artifacts/ts-packages/*.tar.gz
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: Upload JSON and TS package files for tag release
uses: softprops/action-gh-release@v3
if: github.ref_type == 'tag'
with:
files: |
contracts-*.json
tokensMap-*.json
release-artifacts/ts-packages/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}