-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (142 loc) · 5.05 KB
/
Copy pathrelease.yml
File metadata and controls
161 lines (142 loc) · 5.05 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
160
161
name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get version from tag
id: get_version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
build-release:
name: Build Release Binary
needs: create-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: cardano-node
asset_name: cardano-node-linux-x86_64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact_name: cardano-node
asset_name: cardano-node-linux-aarch64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: cardano-node.exe
asset_name: cardano-node-windows-x86_64.exe
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: cardano-node
asset_name: cardano-node-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: cardano-node
asset_name: cardano-node-macos-aarch64
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }} --bin cardano-node
- name: Strip binary (Unix)
if: matrix.os != 'windows-latest'
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
asset_content_type: application/octet-stream
publish-docker:
name: Publish Docker Image
needs: create-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
cardanorust/cardano-node:${{ needs.create-release.outputs.version }}
cardanorust/cardano-node:latest
ghcr.io/${{ github.repository }}:${{ needs.create-release.outputs.version }}
ghcr.io/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
publish-crates:
name: Publish to crates.io
needs: create-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Publish crates
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
# Publish in dependency order
cargo publish -p cardano-crypto --token $CARGO_REGISTRY_TOKEN
sleep 10
cargo publish -p cardano-tracing --token $CARGO_REGISTRY_TOKEN
sleep 10
cargo publish -p cardano-storage --token $CARGO_REGISTRY_TOKEN
sleep 10
cargo publish -p cardano-ledger --token $CARGO_REGISTRY_TOKEN
sleep 10
cargo publish -p cardano-consensus --token $CARGO_REGISTRY_TOKEN
sleep 10
cargo publish -p cardano-network --token $CARGO_REGISTRY_TOKEN
sleep 10
cargo publish -p cardano-api --token $CARGO_REGISTRY_TOKEN
sleep 10
cargo publish -p cardano-testnet --token $CARGO_REGISTRY_TOKEN
sleep 10
cargo publish -p cardano-node --token $CARGO_REGISTRY_TOKEN