diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index a86854e..247b852 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -18,20 +18,21 @@ jobs: steps: - name: Clone repository with submodules run: | - # 1. Bersihkan protokol https:// dari server_url menggunakan shell - RAW_URL="${{ gitea.server_url }}" - SERVER_HOST=${RAW_URL#*//} # Menghapus https:// + # 1. Tentukan Header Otorisasi + # Gitea menerima format "Bearer" untuk token aksi + AUTH_HEADER="Authorization: Bearer ${{ gitea.token }}" - # 2. Set konfigurasi git secara LOKAL untuk sesi shell ini saja - # Kita gunakan GIT_CONFIG_PARAMETERS agar tidak mengotori ~/.gitconfig host + # 2. Suntikkan konfigurasi secara dinamis (hanya untuk sesi ini) + # Ini akan mengirimkan header ke repo utama DAN semua submodules export GIT_CONFIG_COUNT=1 - export GIT_CONFIG_KEY_0="url.https://token:${{ gitea.token }}@${SERVER_HOST}/.insteadOf" - export GIT_CONFIG_VALUE_0="${{ gitea.server_url }}/" + export GIT_CONFIG_KEY_0="http.${{ gitea.server_url }}/.extraheader" + export GIT_CONFIG_VALUE_0="$AUTH_HEADER" # 3. Jalankan clone + # Gunakan variabel langsung, Git akan menangani sisanya git clone --recurse-submodules ${{ gitea.server_url }}/${{ gitea.repository }}.git . - # Debug + # Debug untuk memastikan submodule 'app' terisi ls -la app/ - name: Setup Go @@ -75,20 +76,21 @@ jobs: steps: - name: Clone repository with submodules run: | - # 1. Bersihkan protokol https:// dari server_url menggunakan shell - RAW_URL="${{ gitea.server_url }}" - SERVER_HOST=${RAW_URL#*//} # Menghapus https:// + # 1. Tentukan Header Otorisasi + # Gitea menerima format "Bearer" untuk token aksi + AUTH_HEADER="Authorization: Bearer ${{ gitea.token }}" - # 2. Set konfigurasi git secara LOKAL untuk sesi shell ini saja - # Kita gunakan GIT_CONFIG_PARAMETERS agar tidak mengotori ~/.gitconfig host + # 2. Suntikkan konfigurasi secara dinamis (hanya untuk sesi ini) + # Ini akan mengirimkan header ke repo utama DAN semua submodules export GIT_CONFIG_COUNT=1 - export GIT_CONFIG_KEY_0="url.https://token:${{ gitea.token }}@${SERVER_HOST}/.insteadOf" - export GIT_CONFIG_VALUE_0="${{ gitea.server_url }}/" + export GIT_CONFIG_KEY_0="http.${{ gitea.server_url }}/.extraheader" + export GIT_CONFIG_VALUE_0="$AUTH_HEADER" # 3. Jalankan clone + # Gunakan variabel langsung, Git akan menangani sisanya git clone --recurse-submodules ${{ gitea.server_url }}/${{ gitea.repository }}.git . - # Debug + # Debug untuk memastikan submodule 'app' terisi ls -la app/ - name: Generate latest.json run: | @@ -117,7 +119,7 @@ jobs: name: latest.json path: latest.json - - name: Cleanup Git Config - if: always() # Pastikan tetap jalan meski job gagal - run: | - git config --global --unset-all url."https://token:${{ gitea.token }}@${{ gitea.server_url | replace("https://", "") }}/".insteadOf +# - name: Cleanup Git Config +# if: always() # Pastikan tetap jalan meski job gagal +# run: | +# git config --global --unset-all url."https://token:${{ gitea.token }}@${{ gitea.server_url | replace("https://", "") }}/".insteadOf