diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 35fb5f2..a86854e 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -18,9 +18,21 @@ jobs: steps: - name: Clone repository with submodules run: | - git config --global url."https://token:${{ gitea.token }}@${{ gitea.server_url | replace("https://", "") }}/".insteadOf "${{ gitea.server_url }}/" + # 1. Bersihkan protokol https:// dari server_url menggunakan shell + RAW_URL="${{ gitea.server_url }}" + SERVER_HOST=${RAW_URL#*//} # Menghapus https:// + + # 2. Set konfigurasi git secara LOKAL untuk sesi shell ini saja + # Kita gunakan GIT_CONFIG_PARAMETERS agar tidak mengotori ~/.gitconfig host + 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 }}/" + + # 3. Jalankan clone git clone --recurse-submodules ${{ gitea.server_url }}/${{ gitea.repository }}.git . - ls -la app/ # Debug + + # Debug + ls -la app/ - name: Setup Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff @@ -52,6 +64,32 @@ jobs: name: wgrplane-linux-${{ matrix.goarch }} path: wgrplane-linux-${{ matrix.goarch }} + - 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 + + generate-latest-json: + needs: build + runs-on: ubuntu-latest + 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:// + + # 2. Set konfigurasi git secara LOKAL untuk sesi shell ini saja + # Kita gunakan GIT_CONFIG_PARAMETERS agar tidak mengotori ~/.gitconfig host + 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 }}/" + + # 3. Jalankan clone + git clone --recurse-submodules ${{ gitea.server_url }}/${{ gitea.repository }}.git . + + # Debug + ls -la app/ - name: Generate latest.json run: | VERSION="${{ gitea.ref_name }}"