-
Notifications
You must be signed in to change notification settings - Fork 76
88 lines (83 loc) · 2.57 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
name: Release
on:
push:
branches:
- main
tags:
- "v*"
env:
GO_VERSION: "1.19"
jobs:
build:
name: Build Release
runs-on: ubuntu-latest
steps:
- name: Set Release Version
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
echo "RELEASE_VERSION=${releasever}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 100
- name: Setup buildx instance
uses: docker/setup-buildx-action@v2
with:
use: true
- name: Build
shell: bash
run: |
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
if [[ -z ${RELEASE_VERSION} ]]; then
git fetch --tags
RELEASE_VERSION=$(git tag --sort=v:refname -l v* | tail -1)
fi
echo "RELEASE_VERSION=${RELEASE_VERSION}"
docker buildx build --build-arg RELEASE_VERSION=${RELEASE_VERSION} --build-arg GO_VERSION=${{ env.GO_VERSION }} -f .github/workflows/release/Dockerfile --platform=linux/amd64,linux/arm64 -o releases/ .
ls -l releases/*/
- name: Upload
uses: actions/upload-artifact@v3
with:
name: releases
path: releases/*/overlaybd-snapshotter*
dev-release:
name: Development Release
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download builds and release notes
uses: actions/download-artifact@v3
- name: Display downloaded files
shell: bash
run: ls -l releases/*/
- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: |
releases/*/overlaybd-snapshotter*
release:
name: Tagged Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download builds and release notes
uses: actions/download-artifact@v3
- name: Display downloaded files
shell: bash
run: ls -l releases/*/
- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
releases/*/overlaybd-snapshotter*