Skip to content

Get changelog automatically #38

Get changelog automatically

Get changelog automatically #38

Workflow file for this run

name: build
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
create:
tags:
- v*
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python-version: [ 3.7 ]
outputs:
changelog: ${{ steps.changelog.outputs.changelog }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Lint
run: flake8
- name: Get changelog
id: changelog
run: |
printf "changelog<<EOF\n" >>"${GITHUB_OUTPUT}"
perl -0777ne '/<news>\s*(.*?)\s*<\/news>/s && print $1' addon.xml >>"${GITHUB_OUTPUT}"
printf "\nEOF\n" >>"${GITHUB_OUTPUT}"
release:
name: Release
runs-on: ubuntu-latest
needs: build
if: success() && github.event_name == 'create' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Perform release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ needs.build.outputs.changelog }}
draft: false
prerelease: false