-
Notifications
You must be signed in to change notification settings - Fork 9
104 lines (91 loc) · 3.26 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
name: Release
on:
push:
tags:
# SemVer regex taken from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# Added option to start with a v for cases like v0.0.1
- "[0-9]+.[0-9]+.[0-9]+-rc[0-9]*"
- "[0-9]+.[0-9]+.[0-9]+-alpha[0-9]*"
- "[0-9]+.[0-9]+.[0-9]+-beta[0-9]*"
- "[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]*"
- "v[0-9]+.[0-9]+.[0-9]+-alpha[0-9]*"
- "v[0-9]+.[0-9]+.[0-9]+-beta[0-9]*"
- "v[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write
pull-requests: write
packages: write
concurrency:
group: ci-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
env:
REGISTRY_IMAGE: ghcr.io/sedaprotocol/seda-chain
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.release_tag }}
- name: 🐳 Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: 🐳 Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 🐳 Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🔨 Build Binaries
run: |
export VERSION=$(echo $(git describe --tags --always --match "v*") | sed 's/^v//')
export COMMIT=$(git log -1 --format='%H')
docker build -t seda-static -f ./dockerfiles/Dockerfile.build-static \
--build-arg GIT_VERSION="$VERSION" \
--build-arg GIT_COMMIT="$COMMIT" .
mkdir build
docker run --rm -v $(pwd)/build:/output seda-static cp -r /build/. /output/
- name: 🐳 Build and Push
id: build
uses: docker/build-push-action@v5
with:
context: .
file: ./dockerfiles/Dockerfile.release
labels: ${{ steps.meta.outputs.labels }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},name-canonical=true,push=true
tags: ${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }}, ${{ env.REGISTRY_IMAGE }}:latest
- name: 🪵 Conventional Changelog
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.github_token }}
output-file: "false"
skip-commit: true
skip-tag: true
skip-git-pull: true
git-push: false
- name: 🧾 Generate Checksum
uses: jmgilman/actions-generate-checksum@v1
with:
patterns: |
build/sedad-amd64
build/sedad-arm64
- name: 📦 Create GitHub Release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
generateReleaseNotes: true
body: ${{ steps.changelog.outputs.clean_changelog }}
artifacts: "checksum.txt,build/sedad-amd64,build/sedad-arm64"