-
Notifications
You must be signed in to change notification settings - Fork 6
71 lines (59 loc) · 1.98 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
name: Push release to private registry
on:
push:
# This runs the job when new tag is pushed OR a commit/PR is pushed to master
tags:
- "*"
branches:
- master
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo and submodules
uses: actions/checkout@v3
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Install deps
run: forge install
- name: Run tests
run: forge test -vvv
version-tag-match:
runs-on: ubuntu-latest
steps:
- name: Checkout repo and submodules
uses: actions/checkout@v3
- name: Parse cargo.toml and assert version tag matching
# Hacky way of parsing the version from Cargo.toml and comparing it to tag
run: |
if [ "$(cat bindings/rust/Cargo.toml | grep version | head -n 1 |awk '{print $3}' | tr -d '"' )" == "${GITHUB_REF#refs/*/}" ];then exit 0; else exit 1; fi
publish:
needs: [test, version-tag-match]
# Ensure master is tagged
if: github.event.base_ref == 'refs/heads/master'
name: Build & Deploy to registry
env:
CARGO_REGISTRY_DEFAULT: fulmin-labs-registry
CARGO_REGISTRIES_FULMIN_LABS_REGISTRY_INDEX: ${{ secrets.CARGO_REGISTRY_INDEX_URL }}
CARGO_REGISTRIES_FULMIN_LABS_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo and submodules
uses: actions/checkout@v3
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Install deps
run: forge install
- name: Extract Git Tag
run: echo "GIT_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Build contract artifacts
run: forge build
- name: Publish to cargo
working-directory: bindings/rust
run: cargo publish --registry fulmin-labs-registry