Skip to content

Commit 1907521

Browse files
committed
Add migration steps to the migration script
Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 655bb25 commit 1907521

File tree

1 file changed

+147
-0
lines changed

1 file changed

+147
-0
lines changed

cookiecutter/migrate.sh

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,152 @@ echo "========================================================================"
9494
echo "Using symlink aliases in 'mkdocs.yml'"
9595
sed -i "s|alias_type: redirect|alias_type: symlink|" mkdocs.yml
9696

97+
echo "========================================================================"
98+
99+
echo "Fixing credentials not being properly passed in '.github/workflows/ci.yaml'"
100+
patch --merge -p1 <<'EOF'
101+
diff --git a/.github/containers/test-installation/Dockerfile b/.github/containers/test-installation/Dockerfile
102+
index 2494545..ac3de24 100644
103+
--- a/.github/containers/test-installation/Dockerfile
104+
+++ b/.github/containers/test-installation/Dockerfile
105+
@@ -14,5 +14,8 @@ RUN apt-get update -y && \
106+
python -m pip install --upgrade --no-cache-dir pip
107+
108+
COPY dist dist
109+
-RUN pip install dist/*.whl && \
110+
- rm -rf dist
111+
+# This git-credentials file is made available by the GitHub ci.yaml workflow
112+
+COPY git-credentials /root/.git-credentials
113+
+RUN git config --global credential.helper store && \
114+
+ pip install dist/*.whl && \
115+
+ rm -rf dist /root/.git-credentials
116+
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
117+
index 8062a61..67000f1 100644
118+
--- a/.github/workflows/ci.yaml
119+
+++ b/.github/workflows/ci.yaml
120+
@@ -41,6 +41,13 @@ jobs:
121+
runs-on: ${{ matrix.os }}
122+
123+
steps:
124+
+ - name: Setup Git
125+
+ uses: frequenz-floss/[email protected]
126+
+ # TODO(cookiecutter): Uncomment this for projects with private dependencies
127+
+ # with:
128+
+ # username: ${{ secrets.GIT_USER }}
129+
+ # password: ${{ secrets.GIT_PASS }}
130+
+
131+
- name: Print environment (debug)
132+
run: env
133+
134+
@@ -119,6 +126,13 @@ jobs:
135+
runs-on: ${{ matrix.os }}
136+
137+
steps:
138+
+ - name: Setup Git
139+
+ uses: frequenz-floss/[email protected]
140+
+ # TODO(cookiecutter): Uncomment this for projects with private dependencies
141+
+ # with:
142+
+ # username: ${{ secrets.GIT_USER }}
143+
+ # password: ${{ secrets.GIT_PASS }}
144+
+
145+
- name: Fetch sources
146+
uses: actions/checkout@v4
147+
148+
@@ -220,6 +234,13 @@ jobs:
149+
name: Build distribution packages
150+
runs-on: ubuntu-20.04
151+
steps:
152+
+ - name: Setup Git
153+
+ uses: frequenz-floss/[email protected]
154+
+ # TODO(cookiecutter): Uncomment this for projects with private dependencies
155+
+ # with:
156+
+ # username: ${{ secrets.GIT_USER }}
157+
+ # password: ${{ secrets.GIT_PASS }}
158+
+
159+
- name: Fetch sources
160+
uses: actions/checkout@v4
161+
with:
162+
@@ -252,17 +273,31 @@ jobs:
163+
needs: ["build"]
164+
runs-on: ubuntu-20.04
165+
steps:
166+
+ - name: Setup Git
167+
+ uses: frequenz-floss/[email protected]
168+
+ # TODO(cookiecutter): Uncomment this for projects with private dependencies
169+
+ # with:
170+
+ # username: ${{ secrets.GIT_USER }}
171+
+ # password: ${{ secrets.GIT_PASS }}
172+
+
173+
- name: Fetch sources
174+
uses: actions/checkout@v4
175+
+
176+
- name: Download package
177+
uses: actions/download-artifact@v4
178+
with:
179+
name: dist-packages
180+
path: dist
181+
+
182+
+ - name: Make Git credentials available to docker
183+
run: |
184+
touch ~/.git-credentials # Ensure the file exists
185+
+ cp ~/.git-credentials git-credentials || true
186+
+
187+
- name: Set up QEMU
188+
uses: docker/setup-qemu-action@v3
189+
+
190+
- name: Set up docker-buildx
191+
uses: docker/setup-buildx-action@v3
192+
+
193+
- name: Test Installation
194+
uses: docker/build-push-action@v6
195+
with:
196+
@@ -277,14 +312,18 @@ jobs:
197+
if: github.event_name != 'push'
198+
runs-on: ubuntu-20.04
199+
steps:
200+
+ - name: Setup Git
201+
+ uses: frequenz-floss/[email protected]
202+
+ # TODO(cookiecutter): Uncomment this for projects with private dependencies
203+
+ # with:
204+
+ # username: ${{ secrets.GIT_USER }}
205+
+ # password: ${{ secrets.GIT_PASS }}
206+
+
207+
- name: Fetch sources
208+
uses: actions/checkout@v4
209+
with:
210+
submodules: true
211+
212+
- - name: Setup Git user and e-mail
213+
- uses: frequenz-floss/setup-git-user@v2
214+
-
215+
- name: Set up Python
216+
uses: actions/setup-python@v5
217+
with:
218+
@@ -319,14 +358,18 @@ jobs:
219+
permissions:
220+
contents: write
221+
steps:
222+
+ - name: Setup Git
223+
+ uses: frequenz-floss/[email protected]
224+
+ # TODO(cookiecutter): Uncomment this for projects with private dependencies
225+
+ # with:
226+
+ # username: ${{ secrets.GIT_USER }}
227+
+ # password: ${{ secrets.GIT_PASS }}
228+
+
229+
- name: Fetch sources
230+
uses: actions/checkout@v4
231+
with:
232+
submodules: true
233+
234+
- - name: Setup Git user and e-mail
235+
- uses: frequenz-floss/setup-git-user@v2
236+
-
237+
- name: Set up Python
238+
uses: actions/setup-python@v5
239+
with:
240+
EOF
241+
manual_step "Please make sure to remove or uncomment the options to the 'gh-action-setup-git' action in the '.github/workflows/ci.yaml'"
242+
grep -n "TODO(cookiecutter)" -- .github/workflows/ci.yaml .github/containers/test-installation/Dockerfile
243+
97244
# Add a separation line like this one after each migration step.
98245
echo "========================================================================"

0 commit comments

Comments
 (0)