Skip to content

Commit

Permalink
ci: fix changelog of release and README.md update
Browse files Browse the repository at this point in the history
Signed-off-by: Zvi Grinberg <zgrinber@redhat.com>
  • Loading branch information
zvigrinberg committed Oct 17, 2023
1 parent 06d004b commit bb7bf30
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
if: github.repository_owner == 'RHEcosystemAppEng' && startsWith(github.head_ref, 'release/')
outputs:
project_version: ${{ steps.project.outputs.version }}
last_release_tag: ${{ steps.last-release.outputs.tag-name }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand Down Expand Up @@ -64,6 +65,11 @@ jobs:
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: get previous released annotated tag
id: last-release
run: |
echo "tag-name=$(git describe | awk -F '-' '{print $1}')" >> "$GITHUB_OUTPUT"
- name: Deploy release to GitHub
run: |
mvn -DskipTests -Darguments=-DskipTests release:prepare -B -ff
Expand All @@ -88,6 +94,20 @@ jobs:
environment: staging
needs: deploy
steps:

- name: Create release notes for ${{ needs.deploy.outputs.project_version }} release
uses: actions/github-script@v6
id: release-notes
with:
github-token: ${{ secrets.STAGING_PAT }}
script: |
const repo_name = context.payload.repository.full_name
const response = await github.request('POST /repos/' + repo_name + '/releases' + '/generate-notes', {
tag_name: '${{ needs.deploy.outputs.project_version }}',
previous_tag_name: '${{ needs.deploy.outputs.last_release_tag }}'
})
return response.body
- name: Create new ${{ needs.deploy.outputs.project_version }} release
uses: actions/github-script@v6
with:
Expand All @@ -97,10 +117,10 @@ jobs:
const response = await github.request('POST /repos/' + repo_name + '/releases', {
tag_name: '${{ needs.deploy.outputs.project_version }}',
name: '${{ needs.deploy.outputs.project_version }}',
body: '${{ steps.release-notes.outputs.result }}',
draft: false,
prerelease: true,
generate_release_notes: true,
make_latest: 'false'
prerelease: false,
make_latest: 'true'
})
- name: Checkout sources
Expand All @@ -117,6 +137,7 @@ jobs:
- name: Get pom version of new snapshot artifact
id: project_snapshot
run: |
git pull
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> "$GITHUB_OUTPUT"
Expand All @@ -128,7 +149,6 @@ jobs:
- name: Push modifications
run: |
git pull
git add README.md
git commit -m "docs: updated usage section with version ${{ steps.project_snapshot.outputs.version }} [skip ci]"
git push

0 comments on commit bb7bf30

Please sign in to comment.