mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Automate release tag, changelog and man pages
This commit is contained in:
parent
4e1f94db11
commit
dcf85ec760
4 changed files with 250 additions and 3 deletions
53
.github/workflows/release-tag.yml
vendored
Normal file
53
.github/workflows/release-tag.yml
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
name: Generate Tag and Github Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
saltVersion:
|
||||
description: 'Salt Version'
|
||||
required: true
|
||||
reTag:
|
||||
description: 'Re Tag (Deletes tag and release)'
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
GenerateTagRelease:
|
||||
name: Generate Tag and Github Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dev-drprasad/delete-tag-and-release@v0.2.0
|
||||
if: github.event.inputs.reTag == 'true'
|
||||
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/github-tag-action@v5.6
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
custom_tag: ${{ github.event.inputs.saltVersion }}
|
||||
|
||||
- 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: |
|
||||
git fetch --tags origin
|
||||
git checkout v${{ github.event.inputs.saltVersion }}
|
||||
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
.github/workflows/release.yml
vendored
Normal file
182
.github/workflows/release.yml
vendored
Normal file
|
@ -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
|
|
@ -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:
|
||||
|
@ -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/
|
||||
|
|
|
@ -1068,7 +1068,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
|
||||
"""
|
||||
|
@ -1082,4 +1083,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)
|
||||
|
|
Loading…
Add table
Reference in a new issue