-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: GitHub | ||
on: | ||
pull_request: | ||
branches: [main] | ||
#on: | ||
# push: | ||
# tags: ["*"] | ||
|
||
jobs: | ||
release: | ||
runs-on: "ubuntu-latest" | ||
permissions: | ||
id-token: write | ||
name: Create a Release | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Extract the change log from CHANGES.(rst|md) | ||
id: changelog | ||
run: | | ||
# get the lines where the changelog for the last release starts and finishes | ||
first_line=$(grep -n "\-\-\-\-" CHANGES.rst | cut -d":" -f1 |head -n1) | ||
last_line=$(grep -n "\-\-\-\-" CHANGES.rst | cut -d":" -f1 |head -n2 | tail -n1) | ||
# do some math to adjust the line numbers | ||
first=$((${first_line}+1)) | ||
last=$((${last_line}-2)) | ||
end=$((${last_line}-1)) | ||
# extract the changelog | ||
output=$(sed -n "${first},${last}p;${end}q" CHANGES.rst) | ||
# GITHUB_OUTPUT needs a delimiter for multi line strings | ||
delimiter="$(openssl rand -hex 8)" | ||
echo "log<<${delimiter}" >> "${GITHUB_OUTPUT}" | ||
echo "${output}" >> "${GITHUB_OUTPUT}" | ||
echo "${delimiter}" >> "${GITHUB_OUTPUT}" | ||
- name: debug | ||
run: echo '{"tag_name":"${{ github.ref_name }}","name":"${{ github.ref_name }}","body":"${{ steps.changelog.outputs.log }}"}' | ||
# - name: Create a new GitHub release | ||
# run: | | ||
# curl -L \ | ||
# -X POST \ | ||
# --header "Accept: application/vnd.github+json" \ | ||
# --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | ||
# --header "X-GitHub-Api-Version: 2022-11-28" \ | ||
# https://api.github.com/repos/${{ github.repository }}/releases \ | ||
# -d '{"tag_name":"${{ github.ref_name }}","name":"${{ github.ref_name }}","body":"${{ steps.changelog.outputs.log }}"}' | ||
|