Skip to content

Commit

Permalink
Merge pull request #68 from PolicyEngine/fix/changelogging
Browse files Browse the repository at this point in the history
Fix changelogging
  • Loading branch information
anth-volk authored Sep 19, 2024
2 parents 572b643 + fbce19a commit 8161e0c
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 53 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# This workflow is used to check various parts of the
# run prior to merging:

# - The code's formatting
# - Versioning - note that this checks, but does not update
# - That the code builds successfully
# - That any automated tests pass
name: Pull request

on:
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/push_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This builds and pushes the changelog, then
# automatically runs push_2 using the new version number
# to allow for proper pushing to PyPI.

# This script must run first and complete to allow for
# proper versioning.

name: Push 1

on:
push:
branches: [main]

jobs:
check-version:
name: Check version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Build changelog
run: pip install "yaml-changelog>=0.1.7" && make changelog
- name: Preview changelog update
run: ".github/get-changelog-diff.sh"
- name: Check version number has been properly updated
run: ".github/is-version-number-acceptable.sh"
- name: Update changelog
uses: EndBug/add-and-commit@v9
with:
add: "."
committer_name: Github Actions[bot]
author_name: Github Actions[bot]
message: Update PolicyEngine US data
github_token: ${{ secrets.POLICYENGINE_US_DATA_GITHUB_TOKEN }}
65 changes: 12 additions & 53 deletions .github/workflows/push.yaml → .github/workflows/push_2.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Push
# After successful versioning, this script runs various
# parts of the push process
name: Push 2

on:
push:
branches: [main]
workflow_dispatch:
workflow_run:
workflows: ["Push 1"]
types: [completed]

jobs:
lint:
runs-on: ubuntu-latest
if: |
(github.repository == 'PolicyEngine/policyengine-us-data')
&& (github.event.head_commit.message == 'Update PolicyEngine US data')
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Lint
steps:
- uses: actions/checkout@v4
Expand All @@ -24,43 +24,10 @@ jobs:
pip install black
- name: Check formatting
run: black . -l 79 --check
check-version:
name: Check version
runs-on: ubuntu-latest
if: |
(github.repository == 'PolicyEngine/policyengine-us-data')
&& !(github.event.head_commit.message == 'Update PolicyEngine US data')
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Build changelog
run: pip install "yaml-changelog>=0.1.7" && make changelog
- name: Preview changelog update
run: ".github/get-changelog-diff.sh"
- name: Check version number has been properly updated
run: ".github/is-version-number-acceptable.sh"
- name: Update changelog
uses: EndBug/add-and-commit@v9
with:
add: "."
committer_name: Github Actions[bot]
author_name: Github Actions[bot]
message: Update PolicyEngine US data
github_token: ${{ secrets.POLICYENGINE_GITHUB }}
test:
name: Build and test
runs-on: ubuntu-latest
if: |
(github.repository == 'PolicyEngine/policyengine-us-data')
&& (github.event.head_commit.message == 'Update PolicyEngine US data')
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -87,9 +54,7 @@ jobs:
publish-to-pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
if: |
(github.repository == 'PolicyEngine/policyengine-us-data')
&& (github.event.head_commit.message == 'Update PolicyEngine US data')
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -114,9 +79,7 @@ jobs:
docker:
name: Docker
runs-on: ubuntu-latest
if: |
(github.repository == 'PolicyEngine/policyengine-us-data')
&& (github.event.head_commit.message == 'Update PolicyEngine US data')
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand All @@ -133,9 +96,7 @@ jobs:
publish-docs:
name: Publish documentation
runs-on: ubuntu-latest
if: |
(github.repository == 'PolicyEngine/policyengine-us-data')
&& (github.event.head_commit.message == 'Update PolicyEngine US data')
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -159,9 +120,7 @@ jobs:
name: Upload data
runs-on: ubuntu-latest
needs: [lint, test]
if: |
(github.repository == 'PolicyEngine/policyengine-us-data')
&& (github.event.head_commit.message == 'Update PolicyEngine US data')
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- bump: patch
changes:
changed:
- Split push actions into two separate files
- Made run of second portion of push conditional upon run of first

0 comments on commit 8161e0c

Please sign in to comment.