forked from primaza/primazactl
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (86 loc) · 2.98 KB
/
release.yaml
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
name: Release primazactl
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
inputs:
version:
description: "create a version for primazctl"
required: true
default: "latest"
organization:
description: "git organization from which to get the primaza release"
required: true
default: "primaza"
repository_dispatch:
types: [primazactl-release]
permissions:
contents: write
jobs:
build:
name: Deploy releases for Linux
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
architecture: "x64"
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "^1.20"
- name: Checkout code
uses: actions/checkout@v3
- name: Set Version and Draft release
run: |
# set version based on dispatch type
draft_release="true"
if [[ "${{github.event_name}}" == "workflow_dispatch" ]]; then
version=${{ github.event.inputs.version }}
draft_release="false"
echo "GIT_ORG=${{ github.event.inputs.organization }}" >> $GITHUB_ENV
elif [[ "${{github.ref_type}}" == "tag" ]]; then
version=${{ github.ref_name }}
elif [[ "${{github.event_name}}" == "repository_dispatch" ]]; then
version=${{ github.event.client_payload.version }}
draft_release="false"
echo "GIT_ORG=${{ github.event.client_payload.organization }}" >> $GITHUB_ENV
fi
echo "VERSION=$version" >> $GITHUB_ENV
echo "DRAFT_RELEASE=$draft_release" >> $GITHUB_ENV
- name: Test and make manifests
id: test-and-manifests
run: |
# run make test-local to test and create manifests
make test-local
- name: Build binary
run: make single-binary
- name: Delete previous release and tag
if: ${{ env.VERSION == 'latest' || env.VERSION == 'nightly' }}
uses: dev-drprasad/[email protected]
with:
delete_release: true # default: false
tag_name: ${{ env.VERSION }} # tag name to delete
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release for tag event
if: ${{ github.ref_type == 'tag' }}
uses: softprops/action-gh-release@v1
with:
body: "Release version ${{ env.VERSION }}"
draft: true
generate_release_notes: true
files: |
./out/venv3/dist/primazactl
- name: Release for non tag events
if: ${{ github.ref_type != 'tag' }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
body: "Release version ${{ env.VERSION }}"
draft: ${{ env.DRAFT_RELEASE }}
generate_release_notes: true
files: |
./out/venv3/dist/primazactl