This repository was archived by the owner on Nov 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
77 lines (68 loc) · 2.45 KB
/
create_release.yml
File metadata and controls
77 lines (68 loc) · 2.45 KB
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
name: Create Release
on:
workflow_dispatch:
inputs:
version:
description: "New release version (e.g. 0.8.0 or 0.8.1)"
required: true
jobs:
set_version:
runs-on: [self-hosted-org, linux]
steps:
- name: Checkout this repo
uses: actions/checkout@v2
with:
token: ${{ secrets.NOVUM_PRIVATE_REPOS }}
- name: Update medatata.json version
uses: jossef/action-set-json-field@v1
with:
file: metadata.json
field: version
value: ${{ github.event.inputs.version }}
- id: show_diff
name: Show git diff
run: |
git diff
- name: Commit & Push changes
id: push_version
uses: EndBug/add-and-commit@v7
with:
github_token: ${{ secrets.NOVUM_PRIVATE_REPOS }}
branch: 'master'
message: 'Bump version ${{ github.event.inputs.version }}'
author_email: lifecycle-github@telefonica.com
author_name: tuentisre
push: true
- name: get version
id: get_version
uses: notiz-dev/github-action-json-property@release
with:
path: 'metadata.json'
prop_path: 'version'
- id: show_version
name: Show version
run: |
echo "Release version ${{ steps.get_version.outputs.prop }}"
echo "Commit ${{ steps.push_version.outputs.commit_sha }}"
- id: get_release_notes
name: Get release notes
run: |
response=$(curl -s -X POST \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \
-d '{"tag_name":"${{ steps.get_version.outputs.prop }}", "target_commitish": "${{ steps.push_version.outputs.commit_sha }}"}')
echo "JSON Release notes response:"
echo "${response}"
echo ::set-output name=releaseNotesJson::${response}
- id: create_github_release
name: Create Github release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.NOVUM_PRIVATE_REPOS }}
body: "Release ${{steps.get_version.outputs.version }}\n\n${{fromJson(steps.get_release_notes.outputs.releaseNotesJson).body}}"
target_commitish: ${{ steps.push_version.outputs.commit_sha }}
draft: false
prerelease: false
tag_name: "${{ steps.get_version.outputs.prop }}"
name: "v${{ steps.get_version.outputs.prop }}"