-
Notifications
You must be signed in to change notification settings - Fork 15
73 lines (67 loc) · 2.8 KB
/
pre-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
---
name: Prepare new release as PR
on:
repository_dispatch:
types: [release]
permissions:
pull-requests: write
contents: write
jobs:
prepare-release:
name: Prepare Release
runs-on: ubuntu-latest
container: ubuntu:latest
steps:
- name: install packages
run: |
apt-get update && apt-get install -y jq curl git
# Need a new pandoc for markdown rendering below
curl -L https://github.com/jgm/pandoc/releases/download/2.11.1.1/pandoc-2.11.1.1-1-amd64.deb \
> pandoc-2.11.1.1-1-amd64.deb
apt-get install -y ./pandoc-2.11.1.1-1-amd64.deb
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
- name: get git ready
run: |
git config user.name "egibot"
git config user.email "egibot@egi.eu"
- name: Extract version
id: extract-version
run: |
version=$(grep "^## \[[0-9].*\]" CHANGELOG | \
head -1 | sed -e "s/^.*\[\(.*\)\].*/\1/")
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Extract changelog
id: extract-changelog
uses: sean0x42/markdown-extract@v2
with:
file: CHANGELOG
pattern: ${{ steps.extract-version.outputs.version }}
no-print-matched-heading: true
- name: bump versions
run: |
# Zenodo
zenodo_changes=$(echo '${{ steps.extract-changelog.outputs.markdown}}' \
| pandoc --from gfm --to html | tr -s "\n" " ")
jq --arg VERSION "${{ steps.extract-version.outputs.version }}" \
--arg TITLE "EGI-Federation/cloud-info-provider: ${{ steps.extract-version.outputs.version }}" \
--arg RELATED "https://github.com/EGI-Federation/cloud-info-provider/tree/${{ steps.extract-version.outputs.version }}" \
--arg DATE "$(date '+%Y-%m-%d')" \
--arg DESC "$zenodo_changes" \
'.version = $VERSION |
.title = $TITLE |
.related_identifiers[0].identifier = $RELATED |
.publication_date = $DATE |
.description = $DESC' < .zenodo.json > .zenodo.json.new
mv .zenodo.json.new .zenodo.json
git commit -a -m "Prepare version ${{ steps.extract-version.outputs.version }}"
- name: Create Pull Request for version
uses: peter-evans/create-pull-request@v7
with:
delete-branch: true
body: >
Prepares release ${{ steps.extract-version.outputs.version }}
Update .zenodo.json for version ${{ steps.extract-version.outputs.version }}
labels: release
branch: release-${{ steps.extract-version.outputs.version }}
title: Release ${{ steps.extract-version.outputs.version }}