forked from cjolowicz/cookiecutter-hypermodern-python
-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (44 loc) · 1.45 KB
/
update-instance.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Update instance
on:
push:
branches:
- main
concurrency: serialize
env:
TEMPLATE: cookiecutter-hypermodern-python
PROJECT: cookiecutter-hypermodern-python-instance
jobs:
instance:
runs-on: ubuntu-latest
steps:
- name: Check out ${{ env.TEMPLATE }}
uses: actions/checkout@v3
with:
path: ${{ env.TEMPLATE }}
- name: Check out ${{ env.PROJECT }}
uses: actions/checkout@v3
with:
repository: "cjolowicz/${{ env.PROJECT }}"
path: ${{ env.PROJECT }}
token: ${{ secrets.X_GITHUB_TOKEN }}
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install cutty
working-directory: ${{ env.TEMPLATE }}
run: |
pip install --constraint=.github/workflows/constraints.txt cutty
cutty --version
- name: Import commit into ${{ env.PROJECT }}
run: |
cutty import --non-interactive --cwd=${PROJECT} --revision=${GITHUB_SHA}
env:
GIT_AUTHOR_NAME: "GitHub Action"
GIT_AUTHOR_EMAIL: "[email protected]"
- name: Push to cjolowicz/${{ env.PROJECT }}
run: |
if ! git -C ${TEMPLATE} show --no-patch --format=%B ${GITHUB_SHA} | grep -q ^Retrocookie-Original-Commit:
then
git -C $PROJECT push https://$GITHUB_ACTOR:[email protected]/cjolowicz/$PROJECT.git HEAD:main
fi