Skip to content

Commit

Permalink
Fix the changelog generator workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Sep 8, 2022
1 parent dad2bbb commit 7e01650
Showing 1 changed file with 49 additions and 39 deletions.
88 changes: 49 additions & 39 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,59 @@
name: Continuous integration
name: Changelog Generator

on:
push:
branches:
- master
- '[0-9]+.[0-9]+'
- master
tags:
- '*'
pull_request:

env:
HAS_SECRETS: ${{ secrets.HAS_SECRETS }}
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
- '*'

jobs:
build:
name: Continuous integration
changelog:
name: Changelog Generator
runs-on: ubuntu-20.04
timeout-minutes: 15
if: "!startsWith(github.event.head_commit.message, '[skip ci] ')"
timeout-minutes: 10

steps:
- run: docker system prune --all --force
- uses: actions/checkout@v3

- run: echo "${HOME}/.local/bin" >> ${GITHUB_PATH}
- run: python3 -m pip install --user --requirement=ci/requirements.txt

- name: Checks
run: c2cciutils-checks
- name: GitHub event
run: echo ${GITHUB_EVENT} | python3 -m json.tool
env:
GITHUB_EVENT: ${{ toJson(github) }}

- run: python3 -m pip install --user --requirement=requirements.txt
- run: poetry install
- run: poetry run pytest
- run: poetry run prospector --output=pylint sphinx_prompt

- name: Login to pypi
run: |
echo "[pypi]" > ~/.pypirc
echo "username = sbrunner" >> ~/.pypirc
echo "password = ${{ secrets.PYPI_PASSWORD }}" >> ~/.pypirc
if: env.HAS_SECRETS == 'HAS_SECRETS'
- name: Publish
run: c2cciutils-publish
- uses: actions/checkout@v3

- run: echo "${HOME}/.local/bin" >> ${GITHUB_PATH}
- run: python3 -m pip install --user --requirement=ci/requirements.txt

- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d%H%M%S")"
- uses: actions/cache@v3
with:
path: |
.github/changelog-generator-cache
key: changelog-${{ steps.get-date.outputs.date }}
restore-keys: |
changelog-
- name: Get config
id: config
run: echo ::set-output name=config::$(python -c 'print(__import__("json").dumps(__import__("yaml").load(open(".github/changelog-config.yaml"))))')
- name: Generate changelog
id: changelog
uses: heinrichreimer/github-changelog-generator-action@v2.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
configureSections: ${{ steps.config.outputs.config }}
cacheFile: .github/changelog-generator-cache
unreleased: false

- run: c2cciutils-checks --fix --check=prettier
- id: status
run: echo ::set-output name=status::$(git status --short)
- run: |
git add CHANGELOG.md
git config --global user.email "ci@example.com"
git config --global user.name "CI"
git commit -m "Update the changelog"
git checkout -b changelog-update
git push origin changelog-update -f
gh pr create --base=master --fill --label=chore || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: steps.status.outputs.status != ''

0 comments on commit 7e01650

Please sign in to comment.