forked from sustainable-computing-io/kepler
-
Notifications
You must be signed in to change notification settings - Fork 1
144 lines (130 loc) · 4.33 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Release
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
tag:
description: "Tag name, e.g. v0.4"
default: v0.4
required: true
release:
description: "Release name, e.g. release-0.4"
default: release-0.4
required: true
rpm_version:
description: "rpm version, e.g. 0.4"
default: 0.4
required: true
rpm_release:
description: "rpm release, e.g. 1"
default: 1
required: true
committer:
description: "rpm committer, e.g. gh-actions"
default: "gh-actions"
required: false
arch:
description: "rpm arch, e.g. x86_64"
default: "x86_64"
required: false
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "name=date::$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/[email protected]
- name: Create tag
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ github.event.inputs.tag }}',
sha: context.sha
})
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.tag }}
release_name: ${{ github.event.inputs.release }}
draft: false
prerelease: false
- name: Build RPM packages
id: rpm_build
env:
_VERSION_ : ${{ github.event.inputs.rpm_version }}
_RELEASE_: ${{ github.event.inputs.rpm_release }}
_COMMITTER_: ${{ github.event.inputs.committer }}
_ARCH_: ${{ github.event.inputs.arch }}
run: |
make containerized_build_rpm
make containerized_build_container_rpm
cd _output/rpmbuild/
sudo tar czvf /tmp/kepler.rpm.tar.gz RPMS/
- name: release rpm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /tmp/kepler.rpm.tar.gz
asset_name: kepler.rpm.tar.gz
asset_content_type: application/gzip
create-release-branch:
name: Create release branch
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Create release branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: ${{ github.event.inputs.release }}
sha: '${{ github.event.pull_request.head.sha }}'
push-image:
name: Push image to the registry
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Quay
uses: docker/login-action@v3
with:
registry: quay.io/sustainable_computing_io
username: ${{ secrets.BOT_NAME }}
password: ${{ secrets.BOT_TOKEN }}
- name: Build and push kepler latest libbpf image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
tags: quay.io/sustainable_computing_io/kepler:latest, quay.io/sustainable_computing_io/kepler:${{ github.event.inputs.release }}
labels: latest, ${{ github.event.inputs.release }}, libbpf
file: build/Dockerfile
- name: Generate SBOM
uses: anchore/[email protected]
with:
image: quay.io/sustainable_computing_io/kepler:${{ github.event.inputs.release }}
artifact-name: sbom-kepler-${{ github.event.inputs.release }}.json
output-file: ./sbom-kepler-${{ github.event.inputs.release }}.spdx.json
- name: Attach SBOM to release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tag }}
files: ./sbom-kepler-${{ github.event.inputs.release }}.spdx.json
body_path: CHANGELOG.md