-
Notifications
You must be signed in to change notification settings - Fork 26
168 lines (139 loc) · 4.8 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
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
162
163
164
165
166
167
168
name: Release
on:
push:
tags:
- "v*"
jobs:
build:
continue-on-error: true
strategy:
matrix:
include:
# don't change `Linux` or `x86_64` to avoid breaking the
# install script because it relies on the `uname` outputs
- release_for: Linux-x86_64
build_on: ubuntu-latest
target: x86_64-unknown-linux-gnu
args: "--locked --release"
# don't change `Linux` or `arm64` to avoid breaking the
# install script because it relies on the `uname` outputs
- release_for: Linux-arm64
build_on: ubuntu-latest
target: "aarch64-unknown-linux-gnu"
# we skip mithril because of no support for cross compile
args: "--locked --release --no-default-features"
- release_for: Windows-x86_64
build_on: windows-latest
target: x86_64-pc-windows-msvc
args: "--locked --release"
ext: .exe
# don't change `Darwin` or `x86_64` to avoid breaking the
# install script because it relies on the `uname` outputs
- release_for: Darwin-x86_64
build_on: macOS-latest
target: x86_64-apple-darwin
args: "--locked --release"
# don't change `Darwin` or `arm64` to avoid breaking the
# install script because it relies on the `uname` outputs
- release_for: Darwin-arm64
build_on: macOS-latest
target: aarch64-apple-darwin
# we skip mithril because of no support for cross compile
args: "--locked --release --no-default-features"
runs-on: ${{ matrix.build_on }}
steps:
- name: install deps [MacOS]
if: matrix.build_on == 'macOS-latest'
run: |
brew install openssl@1.1
- name: checkout repository
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
shared-key: "release"
- name: build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: build
target: ${{ matrix.target }}
args: ${{ matrix.args }}
strip: true
- name: rename binaries
run: |
mv target/${{ matrix.target }}/release/dolos${{ matrix.ext }} dolos-${{ matrix.release_for }}${{ matrix.ext }}
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: binaries
path: dolos-${{ matrix.release_for }}${{ matrix.ext }}
docker:
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/txpipe/dolos
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern=v{{major}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{version}}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io/txpipe
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: binaries
path: .github/image/bin
# we need to rename the artifact so that the name matches
# the value that Docker uses for TARGET_ARCH to keep the
# Dockerfile simple
- name: Rename artifacts
run: |+
mv .github/image/bin/dolos-Linux-x86_64 .github/image/bin/dolos-Linux-amd64
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .github/image
platforms: linux/arm64,linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
release:
needs: [build, docker]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup go
uses: actions/setup-go@v4
with:
go-version: "1.16"
- name: download artifacts
id: "download"
uses: actions/download-artifact@v3
- name: set release notes
run: |
go install github.com/git-chglog/git-chglog/cmd/git-chglog@v0.15.0
git-chglog -c .github/chglog/release.yml $(git describe --tags) > RELEASE.md
- name: create release
uses: softprops/action-gh-release@v1
with:
files: binaries/*
body_path: RELEASE.md
draft: true