|
| 1 | +name: Generate from Template and Commit to Biskotaki |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'develop' |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - 'master' |
| 10 | + |
| 11 | + |
| 12 | +jobs: |
| 13 | + generate: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + env: |
| 16 | + branch: apply-cookiecutter-python-package-template |
| 17 | + SUPER_SECRET: ${{ secrets.BISKOTAKI_GH_TOKEN }} |
| 18 | + # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v3 |
| 21 | + - shell: bash |
| 22 | + run: | |
| 23 | + if ! [[ "$SUPER_SECRET" ]] |
| 24 | + then |
| 25 | + echo "No BISKOTAKI_GH_TOKEN!" |
| 26 | + echo "Shall NOT authorize access to the biskotaki repo!" |
| 27 | + echo "Exiting .." |
| 28 | + exit 1 |
| 29 | + else |
| 30 | + echo "BISKOTAKI_GH_TOKEN found :)" |
| 31 | + fi |
| 32 | +
|
| 33 | + - run: | |
| 34 | + if ! [[ ${{ secrets.GITHUB_TOKEN }} ]] |
| 35 | + then |
| 36 | + echo "No GITHUB_TOKEN!" |
| 37 | + echo "Shall NOT authorize access to this repo!" |
| 38 | + exit 1 |
| 39 | + else |
| 40 | + echo "GITHUB_TOKEN found :)" |
| 41 | + fi |
| 42 | +
|
| 43 | + if ! [[ "${{ secrets.BISKOTAKI_GH_TOKEN }}" ]] |
| 44 | + then |
| 45 | + echo "No BISKOTAKI_GH_TOKEN!" |
| 46 | + echo "Shall NOT authorize access to the biskotaki repo!" |
| 47 | + echo "Exiting .." |
| 48 | + exit 1 |
| 49 | + else |
| 50 | + echo "BISKOTAKI_GH_TOKEN found :)" |
| 51 | + fi |
| 52 | +
|
| 53 | + echo "GG=V1" >> $GITHUB_ENV |
| 54 | +
|
| 55 | + - run: | |
| 56 | + if ! [[ ${{ env.GG }} ]] |
| 57 | + then |
| 58 | + echo "Failed to read GG var, exported in previous step!" |
| 59 | + echo "Exiting .." |
| 60 | + exit 1 |
| 61 | + else |
| 62 | + echo "Able to read the GG var exported from the previous step :)" |
| 63 | + fi |
| 64 | +
|
| 65 | + - name: Set up Python 3.8 |
| 66 | + uses: actions/setup-python@v2 |
| 67 | + with: |
| 68 | + python-version: "3.8" |
| 69 | + - name: Install dependencies |
| 70 | + run: | |
| 71 | + sudo apt update -y && sudo apt install -y aptitude |
| 72 | + sudo aptitude install -y graphviz |
| 73 | + python -m pip install --upgrade pip |
| 74 | + python -m pip install cookiecutter tox |
| 75 | +
|
| 76 | + - name: Clone Biskotaki repo |
| 77 | + uses: actions/checkout@v3 |
| 78 | + with: |
| 79 | + repository: boromir674/biskotaki |
| 80 | + path: 'cloned/biskotaki' |
| 81 | + |
| 82 | + - name: Find Biskotaki version |
| 83 | + run: | |
| 84 | + cd cloned/biskotaki |
| 85 | + chmod +x ./scripts/parse_version.py |
| 86 | + echo "BISKOTAKI_VERSION=$(scripts/parse_version.py)" >> $GITHUB_ENV |
| 87 | +
|
| 88 | + - name: Generate Biskotaki from Template |
| 89 | + run: | |
| 90 | + echo " version: \"${{ env.BISKOTAKI_VERSION }}\"" >> .github/biskotaki.yaml |
| 91 | + cookiecutter ./src/cookiecutter_python -o gen --config-file ./.github/biskotaki.yaml --no-input |
| 92 | +
|
| 93 | + # - name: Test against multiple 'installation' scenarios |
| 94 | + # run: | |
| 95 | + # cd gen/biskotaki |
| 96 | + # tox -e "py38{, -path, -sdist, -wheel, -dev}" |
| 97 | + # env: |
| 98 | + # PKG_VERSION: ${{ env.BISKOTAKI_VERSION }} |
| 99 | + # - name: Test Operations such as 'build process' and 'linting' |
| 100 | + # run: | |
| 101 | + # cd gen/biskotaki |
| 102 | + # tox -e check |
| 103 | + # tox -e build |
| 104 | + # tox -e lint |
| 105 | + # tox -e graphs |
| 106 | + |
| 107 | + - name: Push to dedicated branch in biskotaki repo |
| 108 | + uses: cpina/github-action-push-to-another-repository@main |
| 109 | + env: |
| 110 | + API_TOKEN_GITHUB: ${{ secrets.BISKOTAKI_GH_TOKEN }} |
| 111 | + with: |
| 112 | + source-directory: 'gen/biskotaki' |
| 113 | + destination-github-username: 'boromir674' |
| 114 | + destination-repository-name: 'biskotaki' |
| 115 | + user-email: k.lampridis@hotmail.com |
| 116 | + user-name: 'Konstantinos' |
| 117 | + destination-repository-username: 'boromir674' |
| 118 | + target-branch: ${{ env.branch }} |
| 119 | + commit-message: 'apply Template from https://github.com/boromir674/cookiecutter-python-package' |
0 commit comments