-
Notifications
You must be signed in to change notification settings - Fork 56
75 lines (62 loc) · 2.23 KB
/
bridge.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
name: Bridge
on:
workflow_run:
workflows: ["Release Tag"]
types: [completed]
workflow_dispatch:
inputs:
force:
description: 'Force execution of this action'
type: boolean
required: false
default: true
env:
CARGO_TERM_COLOR: always
jobs:
Bridge:
runs-on: ubuntu-latest
environment: tags
if: ${{ github.event.workflow_run.conclusion == 'success' || inputs.force }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Protobuf
run: |
sudo apt install -y protobuf-compiler
protoc --version
- name: Build witnet-centralized-ethereum-bridge
run: |
cargo build -p witnet-centralized-ethereum-bridge --release
- name: Move file to outside docker ignored
run: |
cp target/release/witnet-centralized-ethereum-bridge ./
- name: Check Pre-release
run: |
TAG=${{ github.ref_name }}
if [[ "$TAG" =~ - ]]; then
echo "prerelease=true" >> $GITHUB_ENV
else
echo "prerelease=false" >> $GITHUB_ENV
fi
- name: Set Version
run: |
echo VERNUM=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\.]+)?)"/\1/p' ./bridges/centralized-ethereum/Cargo.toml | head -1) >> $GITHUB_ENV
- name: Login to Docker hub Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build & Push Tag Image
run: |
docker build -t witnet/witnet-centralized-ethereum-bridge:"$VERNUM" -f ./docker/bridge/Dockerfile .
docker push witnet/witnet-centralized-ethereum-bridge:"$VERNUM"
- name: Build & Push Latest if not Pre-Release
run: |
docker build -t witnet/witnet-centralized-ethereum-bridge:latest -f ./docker/bridge/Dockerfile .
docker push witnet/witnet-centralized-ethereum-bridge:latest
if: env.prerelease == 'false'
Failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo '(Release Tag) workflow failed, EXITING!!!!' && exit 1