Repository navigation
97 lines (87 loc) · 2.59 KB
/
Copy pathrelease.yml
File metadata and controls
97 lines (87 loc) · 2.59 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
name: Release
on:
workflow_dispatch:
inputs:
tag:
description: "Tag of the release (i.e. 0.1.0)"
required: true
jobs:
push-to-ghcr:
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ inputs.tag }}
- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and push native image
uses: docker/build-push-action@v7
with:
context: .
file: Dockerfile
push: true
platforms: linux/${{ matrix.arch }}
tags: ghcr.io/${{ github.repository_owner }}/staking-brain:build-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.arch }}
publish-manifest:
runs-on: ubuntu-24.04
needs: push-to-ghcr
permissions:
contents: read
packages: write
steps:
- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Publish multi-platform image
env:
IMAGE: ghcr.io/${{ github.repository_owner }}/staking-brain
VERSION: ${{ inputs.tag }}
BUILD: build-${{ github.run_id }}-${{ github.run_attempt }}
run: |
docker buildx imagetools create \
--tag "$IMAGE:$VERSION" \
"$IMAGE:$BUILD-amd64" \
"$IMAGE:$BUILD-arm64"
gh-release:
runs-on: ubuntu-latest
needs: publish-manifest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ inputs.tag }}
- name: Create Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ inputs.tag }}
run: |
case "$RELEASE_TAG" in
*-*) release_flag=--prerelease ;;
*) release_flag=--latest ;;
esac
gh release create "$RELEASE_TAG" --verify-tag --title "Release v$RELEASE_TAG" "$release_flag" --generate-notes