-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Github actions workflow publishing to python-example
Add a Github actions workflow that publishes a generated cookiecutter on the repo vikahl/python-example
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Publish example to python-example | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: # REMOVE THIS BEFORE MERGE | ||
branches: [ main ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish-example: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: | | ||
3.8 | ||
3.9 | ||
3.10 | ||
3.11 | ||
3.12 | ||
- name: Install dependencies | ||
run: pip install cookiecutter tox | ||
|
||
- run: mkdir -p /tmp/generated | ||
|
||
- run: pwd | ||
|
||
- name: Build example repo | ||
working-directory: /tmp/generated | ||
run: | | ||
cookiecutter --config-file ../config/python-example.yaml \ | ||
--no-input ../ | ||
- name: Generate requirements | ||
working-directory: /tmp/generated/python_example | ||
run: tox run -m requirements | ||
|
||
- name: Initialise the git repo | ||
working-directory: /tmp/generated/python_example | ||
run: | | ||
git init | ||
git config user.name "Github actions on vikahl/python-template" | ||
git config user.email "<>" | ||
git remote add python-example "https://vikahl:[email protected]/vikahl/python-example.git" | ||
- name: Unset header that seems to cause auth issues | ||
working-directory: /tmp/generated/python_example | ||
run: git config --unset-all http.https://github.com/.extraheader | ||
|
||
- name: Check out a new branch, commit and push | ||
working-directory: /tmp/generated/python_example | ||
run: | | ||
git checkout -b "sync-$COMMIT" | ||
git add . | ||
git commit -m "Sync from vikahl/python-template $COMMIT" | ||
git push python-example main --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
default_context: | ||
h: "" | ||
project_name: "Python project example" | ||
description: "Example project generated from vikahl/python-template" | ||
module_name: "python_project_example" | ||
author: "Viktor Rimark" | ||
email: "[email protected]" | ||
homepage: "https://blog.rxbx.se" | ||
license: "GPL - ensures that code based on this is shared with the same terms" | ||
version: "1.0.0" | ||
min_python: "3.8" | ||
library: "y" | ||
cli: "y" | ||
service: "y" |