Repository navigation
150 lines (131 loc) · 4.54 KB
/
Copy pathrelease.yaml
File metadata and controls
150 lines (131 loc) · 4.54 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
name: Release
on:
push:
tags:
- 'v*'
env:
IMAGE: ghcr.io/${{ github.repository }}
CI_IMAGE: ghcr.io/${{ github.repository }}/ci:latest
CXX: g++-14
CC: gcc-14
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
arch: amd64
platform: linux/amd64
- runner: ubuntu-24.04-arm
arch: arm64
platform: linux/arm64
runs-on: ${{ matrix.runner }}
permissions:
packages: write
steps:
- uses: actions/checkout@v6
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build binaries in container
run: |
docker run --rm --platform ${{ matrix.platform }} \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
${{ env.CI_IMAGE }} \
sh -c "make release && make test"
- name: Package release archive
run: |
mkdir -p dist
cp cmake-build-release/ui/bit_bridge dist/bit_bridge-linux-${{ matrix.arch }}
cp cmake-build-release/core/bit_bridge_lb dist/bit_bridge_lb-linux-${{ matrix.arch }}
cp bitbridge-settings.toml dist/
tar -czf bit-bridge-${{ github.ref_name }}-linux-${{ matrix.arch }}.tar.gz -C dist .
- name: Upload release archive
uses: actions/upload-artifact@v7
with:
name: bit-bridge-${{ github.ref_name }}-linux-${{ matrix.arch }}
path: bit-bridge-${{ github.ref_name }}-linux-${{ matrix.arch }}.tar.gz
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
endpoint: default
- name: Build and push Docker image by digest
id: docker
uses: docker/build-push-action@v6
with:
context: .
file: .docker/runtime.Dockerfile
platforms: ${{ matrix.platform }}
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.platform }}
cache-to: type=gha,scope=${{ github.ref_name }}-${{ matrix.platform }},mode=max
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.docker.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v7
with:
name: digests-${{ matrix.arch }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
docker-manifest:
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Download digests
uses: actions/download-artifact@v8
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push manifest
working-directory: /tmp/digests
run: |
TAG=${{ github.ref_name }}
docker buildx imagetools create \
-t ${{ env.IMAGE }}:$TAG \
-t ${{ env.IMAGE }}:latest \
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
github-release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Create source archives
run: |
git archive --format=tar.gz --prefix=bit-bridge-${{ github.ref_name }}/ -o bit-bridge-${{ github.ref_name }}-source.tar.gz HEAD
git archive --format=zip --prefix=bit-bridge-${{ github.ref_name }}/ -o bit-bridge-${{ github.ref_name }}-source.zip HEAD
- name: Download artifacts
uses: actions/download-artifact@v8
with:
pattern: bit-bridge-${{ github.ref_name }}-linux-*
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
bit-bridge-${{ github.ref_name }}-linux-*.tar.gz
bit-bridge-${{ github.ref_name }}-source.tar.gz
bit-bridge-${{ github.ref_name }}-source.zip
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, '-') }}