-
Notifications
You must be signed in to change notification settings - Fork 10
104 lines (90 loc) · 2.81 KB
/
codegen.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
name: Codegen
on:
push:
branches-ignore:
- '**'
tags:
- 'v*.*.*'
env:
CODEGEN_ARTIFACTS: 'codegen_artifacts'
GO_CODEGEN_REPOSITORY: 'ethersphere/go-storage-incentives-abi'
ENV_CODEGEN_REPOSITORY: 'ethersphere/docker-setup-contracts'
jobs:
generate-go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
- uses: actions/checkout@v2
with:
repository: ${{env.GO_CODEGEN_REPOSITORY}}
path: ${{env.CODEGEN_ARTIFACTS}}
persist-credentials: false
fetch-depth: 0
ref: master
- name: Generate files
run: |
readonly TARGET_DIR=${{env.CODEGEN_ARTIFACTS}}/abi
mkdir -p "${TARGET_DIR}"
./codegen/generate_src.sh "${{steps.tag.outputs.tag}}" "go" "${TARGET_DIR}"
- name: Commit files
run: |
cd ${{env.CODEGEN_ARTIFACTS}}
git config --local user.email "bee-worker@ethswarm.org"
git config --local user.name "bee-worker"
git add .
git commit -m "generate code for smart contracts ${{steps.tag.outputs.tag}}"
git tag "${{steps.tag.outputs.tag}}"
git log --patch --max-count 1
- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: ${{env.GO_CODEGEN_REPOSITORY}}
directory: ${{env.CODEGEN_ARTIFACTS}}
github_token: ${{secrets.GHA_PAT_BASIC}}
branch: master
tags: true
generate-env:
if: contains(github.event.ref, '-rc')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
- uses: actions/checkout@v2
with:
repository: ${{env.ENV_CODEGEN_REPOSITORY}}
path: ${{env.CODEGEN_ARTIFACTS}}
persist-credentials: false
fetch-depth: 0
ref: master
- name: Generate files
run: |
readonly TARGET_DIR=${{env.CODEGEN_ARTIFACTS}}
mkdir -p "${TARGET_DIR}"
./codegen/generate_src.sh "${{steps.tag.outputs.tag}}" "env" "${TARGET_DIR}"
- name: Commit files
run: |
cd ${{env.CODEGEN_ARTIFACTS}}
git config --local user.email "bee-worker@ethswarm.org"
git config --local user.name "bee-worker"
git add .
git commit -m "generate code for smart contracts ${{steps.tag.outputs.tag}}"
git log --patch --max-count 1
- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: ${{env.ENV_CODEGEN_REPOSITORY}}
directory: ${{env.CODEGEN_ARTIFACTS}}
github_token: ${{secrets.GHA_PAT_BASIC}}
branch: master
tags: true