-
Notifications
You must be signed in to change notification settings - Fork 16
49 lines (46 loc) · 1.95 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
# SPDX-FileCopyrightText: 2021 Comcast Cable Communications Management, LLC
# SPDX-License-Identifier: Apache-2.0
name: release
on:
push:
tags:
# Push events to matching v#.#.#*, ex: v1.2.3, v.2.4.6-beta
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
release:
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Determine repo name
run: |
echo "repo_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "release_slug=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
shell: bash
- name: Create tarball and sha256
run: |
git archive --format=tar.gz -o ${release_slug}.tar.gz --prefix=${release_slug}/ ${version}
git archive --format=zip -o ${release_slug}.zip --prefix=${release_slug}/ ${version}
sha256sum ${release_slug}.tar.gz ${release_slug}.zip > ${release_slug}-sha256sums.txt
mkdir artifacts
cp ${release_slug}* artifacts/.
- name: Prepare Release Body
id: prep
run: |
export version=${GITHUB_REF#refs/tags/}
export NOTES=$(cat CHANGELOG.md | perl -0777 -ne 'print "$1\n" if /.*## \[${version}\]\s(.*?)\s+## \[(v\d+.\d+.\d+)\].*/s')
export TODAY=`date +'%m/%d/%Y'`
echo ::set-output name=rname::$(echo ${version} ${TODAY})
echo ::set-output name=body::${NOTES}
- name: create release
id: create_release
uses: ncipollo/release-action@v1
with:
name: ${{ steps.prep.outputs.rname }}
draft: false
prerelease: false
bodyFile: ${{ steps.prep.outputs.body }}
artifacts: "artifacts/*"
token: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token