-
Notifications
You must be signed in to change notification settings - Fork 1
185 lines (162 loc) · 5.29 KB
/
release.yml
File metadata and controls
185 lines (162 loc) · 5.29 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Publish Docker Image
on:
push:
tags:
- "v*"
branches:
- main
# You can enable the below to build on each PR push for testing,
# pull_request:
# branches:
# - main
env:
REGISTRY: ghcr.io
IMAGE_NAME: lay3rlabs/wavs
jobs:
build_amd64:
name: Build and Push AMD64 Image
runs-on: linux-8-core
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install wkg
run: cargo install wkg
- name: Configure wasm-pkg registry
run: |
mkdir -p ~/.config/wasm-pkg
cat > ~/.config/wasm-pkg/config.toml << 'EOF'
default_registry = "wa.dev"
EOF
- name: Fetch WIT dependencies
run: |
cd wit-definitions/types && wkg wit fetch
cd ../../wit-definitions/operator && wkg wit fetch
cd ../../wit-definitions/aggregator && wkg wit fetch
- name: Set IMAGE_TAG
shell: bash
run: |
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
TAG="${GITHUB_REF_NAME#v}"
IMAGE_TAG="${TAG//[^a-zA-Z0-9_.-]/-}"
elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then
IMAGE_TAG="latest"
else
IMAGE_TAG="${GITHUB_REF_NAME//\//-}"
fi
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push AMD64 image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-amd64
platforms: linux/amd64
provenance: false
build_arm64:
name: Build and Push ARM64 Image
runs-on: arm64-builder
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install wkg
run: cargo install wkg
- name: Configure wasm-pkg registry
run: |
mkdir -p ~/.config/wasm-pkg
cat > ~/.config/wasm-pkg/config.toml << 'EOF'
default_registry = "wa.dev"
EOF
- name: Fetch WIT dependencies
run: |
cd wit-definitions/types && wkg wit fetch
cd ../../wit-definitions/operator && wkg wit fetch
cd ../../wit-definitions/aggregator && wkg wit fetch
- name: Set IMAGE_TAG
shell: bash
run: |
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
TAG="${GITHUB_REF_NAME#v}"
IMAGE_TAG="${TAG//[^a-zA-Z0-9_.-]/-}"
elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then
IMAGE_TAG="latest"
else
IMAGE_TAG="${GITHUB_REF_NAME//\//-}"
fi
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push ARM64 image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-arm64
platforms: linux/arm64
provenance: false
create_manifest:
name: Create and Push Multi-Arch Manifest
runs-on: ubuntu-latest
needs: [build_amd64, build_arm64]
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Set IMAGE_TAG
shell: bash
run: |
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
TAG="${GITHUB_REF_NAME#v}"
IMAGE_TAG="${TAG//[^a-zA-Z0-9_.-]/-}"
elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then
IMAGE_TAG="latest"
else
IMAGE_TAG="${GITHUB_REF_NAME//\//-}"
fi
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push multi-arch manifest
run: |
export GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
docker buildx imagetools create \
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} \
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$GIT_HASH \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-amd64 \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-arm64