Skip to content

Commit

Permalink
Automate build of changelog and man pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Megan Wilhite committed Oct 11, 2021
1 parent 4998b6c commit acd3fde
Show file tree
Hide file tree
Showing 7 changed files with 298 additions and 3 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release-re-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Re-Tag Release

on:
workflow_dispatch:
inputs:
saltVersion:
description: 'Salt Version'
required: true

jobs:
ReGenerateTagRelease:
name: Re-Generate Tag and Github Release
runs-on: ubuntu-latest
steps:
- uses: dev-drprasad/[email protected]
with:
delete_release: true # default: false
tag_name: v${{ github.event.inputs.saltVersion }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v2
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ github.event.inputs.saltVersion }}
dry_run: True

- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install pypa/build
run: |
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --outdir dist/ .
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.new_tag }}
artifacts: dist/salt*.tar.gz
41 changes: 41 additions & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Generate Tag and Github Release

on:
workflow_dispatch:
inputs:
saltVersion:
description: 'Salt Version'
required: true

jobs:
GenerateTagRelease:
name: Generate Tag and Github Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ github.event.inputs.saltVersion }}
dry_run: True

- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install pypa/build
run: |
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --outdir dist/ .
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.new_tag }}
artifacts: dist/salt*.tar.gz
182 changes: 182 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
name: Generate Release Docs

on:
workflow_dispatch:
inputs:
saltVersion:
description: 'Salt Version'
required: true
manPages:
description: "Build Man Pages"
default: true
required: false

jobs:
SaltChangelog:
name: Build Salt Changelog
runs-on: ubuntu-latest

container:
image: python:3.8.6-slim-buster

steps:

- name: Install System Deps
run: |
echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
apt-get update
apt-get install -y enchant git gcc imagemagick make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev xz-utils
apt-get install -y git/buster-backports
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install Nox
env:
PIP_EXTRA_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
run: |
python -m pip install --upgrade pip
pip install nox
- id: changed-files
name: Get Changed Files
uses: dorny/paths-filter@v2
with:
token: ${{ github.token }}
list-files: json
filters: |
docs:
- doc/**
- name: Install Python Requirements
env:
PIP_EXTRA_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
run: |
nox --install-only --forcecolor -e 'changelog(force=True, draft=False)' -- ${{ github.event.inputs.saltVersion }}
nox --install-only --forcecolor -e 'changelog(force=False, draft=True)' -- ${{ github.event.inputs.saltVersion }}
- name: Build Changelog
env:
SKIP_REQUIREMENTS_INSTALL: YES
run: |
nox --forcecolor -e 'changelog(force=False, draft=True)' -- ${{ github.event.inputs.saltVersion }} > rn_changelog
nox --forcecolor -e 'changelog(force=True, draft=False)' -- ${{ github.event.inputs.saltVersion }}
- name: Store Generated Changelog
uses: actions/upload-artifact@v2
with:
name: salt-changelog
path: |
CHANGELOG.md
changelog/*
rn_changelog
Manpages:
name: Build Salt man Pages
runs-on: ubuntu-latest

container:
image: python:3.8.6-slim-buster

steps:

- name: Install System Deps
if: github.event.inputs.manPages == 'true'
run: |
echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
apt-get update
apt-get install -y enchant git gcc imagemagick make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev
apt-get install -y git/buster-backports
- uses: actions/checkout@v2

- id: changed-files
if: github.event.inputs.manPages == 'true'
name: Get Changed Files
uses: dorny/paths-filter@v2
with:
token: ${{ github.token }}
list-files: json
filters: |
docs:
- doc/**
- name: Install Nox
if: github.event.inputs.manPages == 'true'
env:
PIP_EXTRA_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
run: |
python -m pip install --upgrade pip
pip install nox
- name: Install Python Requirements
if: github.event.inputs.manPages == 'true'
env:
PIP_EXTRA_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
run:
nox --install-only --forcecolor -e 'docs-man(compress=False, update=True, clean=True)'

- name: Build Manpages
if: github.event.inputs.manPages == 'true'
env:
SKIP_REQUIREMENTS_INSTALL: YES
run: |
nox --forcecolor -e 'docs-man(compress=False, update=True, clean=True)'
- name: Store Generated Documentation
if: github.event.inputs.manPages == 'true'
uses: actions/upload-artifact@v2
with:
name: salt-man-pages
path: doc/_build/man

PullRequest:
needs: [SaltChangelog, Manpages]
name: Create Pull Request
runs-on: ubuntu-latest

container:
image: python:3.8.6-slim-buster

steps:
- name: Install System Deps
run: |
echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
apt-get update
apt-get install -y enchant git gcc imagemagick make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev xz-utils
apt-get install -y git/buster-backports
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Download salt-man-pages
if: github.event.inputs.manPages == 'true'
uses: actions/download-artifact@v2
with:
name: salt-man-pages
path: doc/man/

- name: Download salt changelog
uses: actions/download-artifact@v2
with:
name: salt-changelog

- name: Generate Release Notes
run: |
sed -i '0,/^======/d' rn_changelog
cat rn_changelog
cat rn_changelog >> doc/topics/releases/${{ github.event.inputs.saltVersion }}.rst
rm rn_changelog
- name: Create Pull Request for Release
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Add changelog and docs for release
title: 'Generate Salt Man Page and Changelog'
body: >
This PR is auto-generated by
[create-pull-request](https://github.com/peter-evans/create-pull-request).
branch: freeze
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ Versions are `MAJOR.PATCH`.

# Changelog

Salt v3004 (2021-10-11)
=======================

Fixed
-----

- Clear and update the Pillar Cache when running saltutil.refresh_pillar. This only affects users
that have `pillar_cache` set to True. If you do not want to clear the cache you can pass the kwarg
`clean_cache=False` to `saltutil.refresh_pillar`. (#60897)


Salt 3004 (2021-09-27)
======================

Expand Down
12 changes: 10 additions & 2 deletions doc/topics/development/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ you can run towncrier in draft mode:
.. code-block:: bash
nox -e 'changelog(draft=True)' -- 3000.1
nox -e 'changelog(force=False, draft=True)' -- 3000.1
Version will need to be set to whichever version we are about to release. Once you are
confident the draft output looks correct you can now generate the changelog by running:
Expand All @@ -87,11 +87,19 @@ confident the draft output looks correct you can now generate the changelog by r
.. code-block:: bash
nox -e 'changelog(draft=False)' -- 3000.1
nox -e 'changelog(force=False, draft=False)' -- 3000.1
After this is run towncrier will automatically remove all the files in the changelog directory.


If you want to force towncrier to automatically remove all the files in the changelog directory
without asking you to type yes, you can set force to True.

.. code-block:: bash
nox -e 'changelog(force=True, draft=False)' -- 3000.1
.. _`SEP 01`: https://github.com/saltstack/salt-enhancement-proposals/pull/2
.. _`keepachangelog`: https://keepachangelog.com/en/1.0.0/
.. _`towncrier`: https://pypi.org/project/towncrier/
6 changes: 5 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,8 @@ def invoke(session):

@nox.session(name="changelog", python="3")
@nox.parametrize("draft", [False, True])
def changelog(session, draft):
@nox.parametrize("force", [False, True])
def changelog(session, draft, force):
"""
Generate salt's changelog
"""
Expand All @@ -1131,4 +1132,7 @@ def changelog(session, draft):
town_cmd = ["towncrier", "--version={}".format(session.posargs[0])]
if draft:
town_cmd.append("--draft")
if force:
# Do not ask, just remove news fragments
town_cmd.append("--yes")
session.run(*town_cmd)
1 change: 1 addition & 0 deletions release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3004

0 comments on commit acd3fde

Please sign in to comment.