Skip to content

Commit 178d1ad

Browse files
committed
Chore/build release (burnt-labs#239)
Modify CI/CD flows to insure tests run against the same binaries for releases
1 parent 2c88c66 commit 178d1ad

17 files changed

+677
-524
lines changed

.github/workflows/aws-ecr.yml

-59
This file was deleted.

.github/workflows/docker-build.yml

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Build and Push Docker Images
2+
3+
# reusable workflow, do not add triggers
4+
on:
5+
workflow_call:
6+
workflow_dispatch:
7+
8+
env:
9+
GHCR: ghcr.io/${{ github.repository }}
10+
PLATFORMS: linux/amd64
11+
12+
jobs:
13+
build-docker:
14+
name: Build Docker Images
15+
runs-on: ubuntu-latest
16+
environment: CI
17+
permissions:
18+
id-token: write
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Configure AWS credentials
24+
uses: aws-actions/configure-aws-credentials@v4
25+
with:
26+
aws-region: us-east-1
27+
role-to-assume: ${{ secrets.AWS_OIDC_ROLE }}
28+
29+
- name: Login to Amazon ECR
30+
id: login-ecr
31+
uses: aws-actions/amazon-ecr-login@v2
32+
33+
- name: Login to Docker Hub
34+
uses: docker/login-action@v3
35+
with:
36+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
37+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
38+
39+
- name: Login to GitHub Container Registry
40+
uses: docker/login-action@v3
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.repository_owner }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Check out code
47+
uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 1
50+
fetch-tags: true
51+
ref: ${{ github.ref }}
52+
53+
- name: Set up docker buildx for push
54+
uses: docker/setup-buildx-action@v3
55+
56+
57+
- name: Metadata for xion container
58+
id: meta-xion
59+
uses: docker/metadata-action@v5
60+
with:
61+
images: |
62+
burntnetwork/xion
63+
${{ env.GHCR }}/xion
64+
385156030167.dkr.ecr.us-east-1.amazonaws.com/burnt/xiond
65+
tags: |
66+
type=sha
67+
type=semver,pattern={{version}},enable=${{ github.event_name == 'push' }}
68+
type=raw,value=latest,enable={{is_default_branch}}
69+
70+
- name: Prepare xion build environment
71+
run: |
72+
echo "VERSION=$(shell echo $(shell git describe --tags) | sed 's/^v//')" >> $GITHUB_ENV
73+
echo "COMMIT=$(shell git log -1 --format='%H')" >> $GITHUB_ENV
74+
echo "TAG_VERSION=$(shell git rev-parse --short HEAD)" >> $GITHUB_ENV
75+
76+
- name: Build and push xion image
77+
uses: docker/build-push-action@v5
78+
env:
79+
COMMIT: ${{ env.COMMIT }}
80+
VERSION: ${{ env.VERSION }}
81+
TAG_VERSION: ${{ env.TAG_VERSION }}
82+
with:
83+
push: true
84+
cache-from: type=gha
85+
cache-to: type=gha,mode=max
86+
target: release
87+
platforms: ${{ env.PLATFORMS }}
88+
tags: ${{ steps.meta-xion.outputs.tags }}
89+
labels: ${{ steps.meta-xion.outputs.labels }}

.github/workflows/docker-hub.yml

-93
This file was deleted.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Docker Scout
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build-docker-scout:
8+
name: Build and Push Docker Images
9+
uses: burnt-labs/xion/.github/workflows/docker-build.yml@wf1
10+
secrets: inherit
11+
12+
docker-scout:
13+
needs: build-docker-scout
14+
name: Docker Scout
15+
uses: burnt-labs/xion/.github/workflows/docker-scout.yml@wf1

.github/workflows/docker-scout.yml

+17-33
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,39 @@
1-
---
21
name: Docker Scout
32

3+
# reusable workflow, do not add triggers
44
on:
5-
pull_request:
6-
workflow_dispatch:
5+
workflow_call:
76

87
jobs:
9-
10-
build:
8+
docker-scout:
119
name: Docker Scout
1210
runs-on: ubuntu-latest
1311
environment: CI
12+
permissions:
13+
contents: read
14+
pull-requests: write
1415

16+
strategy:
17+
matrix:
18+
platform: [linux/amd64]
1519
steps:
16-
- name: Check out code
17-
uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 0
20-
fetch-tags: true
21-
2220
- name: Login to Docker Hub
2321
uses: docker/login-action@v3
2422
with:
2523
username: ${{ secrets.DOCKER_HUB_USERNAME }}
2624
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
27-
28-
- name: Set up Docker buildx
29-
uses: docker/setup-buildx-action@v3
30-
31-
- name: Extract metadata for docker
32-
id: meta
25+
- name: Get Docker Image
26+
id: meta-scout
3327
uses: docker/metadata-action@v5
3428
with:
35-
images: burnt/xion
29+
images: |
30+
burntnetwork/xion
3631
tags: |
37-
type=raw,value=scout,priority=1000
38-
39-
- name: Build Docker image
40-
uses: docker/build-push-action@v5
41-
with:
42-
context: .
43-
push: false
44-
load: true
45-
tags: ${{ steps.meta.outputs.tags }}
46-
cache-from: type=gha
47-
cache-to: type=gha,mode=max
48-
target: release
49-
50-
- name: Run Docker Scout
32+
type=sha
33+
- name: Run Docker Scout amd64
5134
uses: docker/scout-action@v1
5235
with:
5336
command: cves
5437
only-fixed: true
55-
image: ${{ steps.meta.outputs.tags }}
38+
platform: ${{ matrix.platform }}
39+
image: ${{ steps.meta-scout.outputs.tags }}

.github/workflows/golangci-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- uses: actions/checkout@v4
3030

3131
- name: golangci-lint-xiond
32-
uses: golangci/golangci-lint-action@v4
32+
uses: golangci/golangci-lint-action@v5
3333
with:
3434
version: latest
3535
args: --timeout=10m --tests=false

0 commit comments

Comments
 (0)