forked from bosonprotocol/boson-protocol-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (91 loc) · 3.59 KB
/
deploy-pre-release.yaml
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
name: Deploy pre-release to Mumbai env
on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to create'
required: true
jobs:
mumbai_deploy:
runs-on: ubuntu-latest
env:
DEPLOYER_GAS_LIMIT: ${{ secrets.DEPLOYER_GAS_LIMIT }}
DEPLOYER_MUMBAI_TXNODE: ${{ secrets.DEPLOYER_MUMBAI_TXNODE }}
DEPLOYER_MUMBAI_KEY: ${{ secrets.DEPLOYER_MUMBAI_KEY }}
DEPLOYER_POLYGONSCAN_API_KEY: ${{ secrets.DEPLOYER_POLYGONSCAN_API_KEY }}
CONFIRMATIONS: ${{ secrets.CONFIRMATIONS }}
name: mumbai_deploy
steps:
- name: Checkout repository
uses: actions/[email protected]
with:
token: ${{ secrets.BSNORG_ACTIONS_SECRET }}
fetch-depth: 0
- name: Setup node
uses: actions/[email protected]
with:
node-version: '16.14.x'
cache: 'npm'
- run: npm ci
- name: Prepare Environment
shell: bash
run: |
cp .env.example .env
- name: Create empty logs directory
shell: bash
run: |
mkdir -p logs
mkdir -p addresses/abis/mumbai
- name: Deploy to mumbai testnet
run: npm run deploy-suite:polygon:mumbai
- name: Upload Mumbai deploy output
uses: actions/upload-artifact@v2
with:
name: mumbai-deploy-contracts-logs
path: logs/mumbai.deploy.contracts.txt
- name: Copy abis from artifacts directory to abis subfolder
shell: bash
run: |
rsync -av --exclude='*.dbg.json' artifacts/contracts/interfaces addresses/abis/mumbai/
# create a new tag on the selected branch with the build artifacts and push it
- name: Commit auto-generated files (branch)
if: ${{ github.ref_type == 'branch' }}
run: |
NEW_TAG=${{ inputs.tag }}
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions Bot"
git add addresses/ logs/
git commit -a \
-m "[skip ci] Add json file with addresses for staging environment" \
-m "[Staging Environment] New deployed addresses" \
-m "This is an auto-generated commit. This commit contains addresses generated after deploy to the staging environment."
git tag $NEW_TAG
git push origin $NEW_TAG
# we are deploying from a tag - create a new branch with the build artifacts
- name: Commit auto-generated files (tag)
if: ${{ github.ref_type == 'tag' }}
run: |
RELEASE_BRANCH=pre-release-${GITHUB_REF_NAME}
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions Bot"
git checkout -b $RELEASE_BRANCH
git add addresses/ logs/
git commit -a \
-m "[skip ci] Add json file with addresses for staging environment" \
-m "[Staging Environment] New deployed addresses" \
-m "This is an auto-generated commit. This commit contains addresses generated after deploy to the staging environment."
git push origin $RELEASE_BRANCH
- name: Create Pull Request for the auto-generated files
if: ${{ github.ref_type == 'tag' }}
uses: actions/github-script@v6
with:
script: |
const { repo, owner } = context.repo;
github.rest.pulls.create({
title: '[Staging Environment] New deployed addresses',
owner,
repo,
head: '${{ github.ref_name }}',
base: 'main',
body: ''
});