-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (139 loc) · 4.25 KB
/
deploy.yml
File metadata and controls
159 lines (139 loc) · 4.25 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
152
153
154
155
156
157
158
159
name: Deploy
on:
push:
tags:
- 'v*'
branches: [ main ]
workflow_dispatch:
inputs:
environment:
description: 'Deployment environment'
required: true
default: 'testnet'
type: choice
options:
- testnet
- mainnet
- staging
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v6.0.2
- name: Install stable toolchain
uses: actions-rust-toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Rust Cache
uses: swatinem/rust-cache@v2
- name: Check workspace
run: cargo check --workspace --all-targets
- name: Run tests
run: cargo test --workspace --release
- name: Build release
run: cargo build --workspace --release
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: rechain-binaries
path: |
target/release/rechain
target/release/rechain-execute-worker
target/release/rechain-prepare-worker
docker-build:
name: Build Docker Images
runs-on: ubuntu-latest
needs: build-and-test
steps:
- name: Checkout sources
uses: actions/checkout@v6.0.2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: rechain-network/rechain-node
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy-testnet:
name: Deploy to Testnet
runs-on: ubuntu-latest
needs: docker-build
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
steps:
- name: Deploy to testnet
run: |
echo "🚀 Deploying to REChain testnet..."
# Deployment logic would go here
echo "✅ Testnet deployment completed"
deploy-mainnet:
name: Deploy to Mainnet
runs-on: ubuntu-latest
needs: docker-build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Deploy to mainnet
run: |
echo "🚀 Deploying to REChain mainnet..."
# Production deployment logic would go here
echo "✅ Mainnet deployment completed"
generate-release:
name: Generate Release
runs-on: ubuntu-latest
needs: [build-and-test, docker-build]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout sources
uses: actions/checkout@v6.0.2
- name: Generate changelog
id: changelog
run: |
# Generate changelog from git history
echo "## What's Changed" > CHANGELOG.md
git log --oneline --since="2 weeks ago" >> CHANGELOG.md
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: CHANGELOG.md
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
notify:
name: Notify Deployment
runs-on: ubuntu-latest
needs: [deploy-testnet, deploy-mainnet]
if: always()
steps:
- name: Notify deployment status
run: |
echo "📢 Deployment notification..."
# Integration with Discord, Slack, or other notification systems
echo "✅ Deployment pipeline completed"