Github Release #3
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
# https://github.com/marketplace/actions/release-changelog-builder | |
name: 'Github Release' | |
run-name: 'Github Release' | |
on: | |
repository_dispatch: | |
types: [github-release] | |
concurrency: | |
group: ${{ github.event.pull_request.number }}-ci | |
cancel-in-progress: true | |
jobs: | |
build: | |
if: github.event.client_payload.auto_release == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get Latest Release Tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "latest_release_tag=$(curl -sL \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${GITHUB_TOKEN}"\ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/${{github.event.repository.owner.login}}/${{github.event.repository.name}}/releases/latest | jq -r '.tag_name')" >> $GITHUB_ENV | |
echo "currentTag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV | |
- name: Build Changelog | |
uses: mikepenz/release-changelog-builder-action@v2 | |
with: | |
configuration: ".github/configs/configuration_repo.json" | |
fromTag: ${{env.latest_release_tag}} | |
toTag: ${{env.currentTag}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body: ${{steps.github_release.outputs.changelog}} | |
tag_name: ${{env.currentTag}} | |
- name: Artifact Information | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
run: | | |
echo "archive_download_url=$(curl -sSL \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${GITHUB_TOKEN}"\ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/${{github.event.repository.owner.login}}/${{github.event.repository.name}}/actions/artifacts | jq -r '.artifacts[0].archive_download_url')" >> $GITHUB_ENV | |
- name: Download Artifact | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
curl -sSL \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${GITHUB_TOKEN}"\ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
${{ env.archive_download_url }} -o ${{ github.event.client_payload.artifact }}.zip | |
- name: Upload Assets to Release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ github.event.client_payload.artifact }}.zip | |
tag: ${{env.currentTag}} |