generated from IRNAS/irnas-zephyr-template
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (56 loc) · 1.99 KB
/
publish-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
name: "Publish Release"
on:
workflow_call:
inputs:
release_version:
required: true
type: string
jobs:
publish-new-release:
runs-on: ubuntu-20.04
# runs-on: self-hosted
steps:
- name: Start
run: |
version_cut=$(echo "${{ inputs.release_version }}" | cut -c 2-)
echo "release_version=${{ inputs.release_version }}" >> $GITHUB_ENV
echo "release_version_cut=$version_cut" >> $GITHUB_ENV
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ env.release_version }}
- name: Get latest Changelog entry
id: changelog-reader
uses: mindsers/[email protected]
with:
version: ${{ env.release_version_cut }}
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: artefacts
path: artefacts
- name: Read extra release notes
run: |
# Echoing contents of the below .md files needs to be done in special
# manner, as they will usually be multiline strings.
# EOF needs to be random value for security reasons
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "pre_changelog<<$EOF" >> $GITHUB_ENV
echo "$(cat artefacts/pre_changelog.md)" >> $GITHUB_ENV
echo "$EOF" >> $GITHUB_ENV
echo "post_changelog<<$EOF" >> $GITHUB_ENV
echo "$(cat artefacts/post_changelog.md)" >> $GITHUB_ENV
echo "$EOF" >> $GITHUB_ENV
rm -f artefacts/pre_changelog.md
rm -f artefacts/post_changelog.md
- name: Publish Release
if: ${{ !env.ACT }}
uses: softprops/[email protected]
with:
files: artefacts/*
tag_name: ${{ env.release_version }}
body: |
# Release notes
${{ env.pre_changelog }}
${{ steps.changelog-reader.outputs.changes }}
${{ env.post_changelog }}