fix(ci): private repo auth (#508)

This commit is contained in:
Hazel 2024-04-24 22:08:35 +01:00 committed by GitHub
parent e535a35fb9
commit 826199c055
3 changed files with 14 additions and 4 deletions

View file

@ -17,6 +17,8 @@ inputs:
targets: targets:
description: 'Targets we plan to compile to. Installs native dependencies needed.' description: 'Targets we plan to compile to. Installs native dependencies needed.'
required: true required: true
gh-token:
description: 'GitHub secret for private repos as dependencies'
runs: runs:
using: "composite" using: "composite"
@ -73,7 +75,9 @@ runs:
name: Install dependencies name: Install dependencies
shell: bash shell: bash
run: | run: |
haxelib --debug --global run hmm install git config --global url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf https://github.com/
haxelib --global run hmm install -q
git config --global --unset url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf
echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV"
# by default use a shared hxcpp cache # by default use a shared hxcpp cache

View file

@ -23,9 +23,8 @@ jobs:
steps: steps:
- name: Make git happy - name: Make git happy
if: ${{ matrix.target == 'macos' }}
run: | run: |
git config --global --add safe.directory $GITHUB_WORKSPACE git config --global --replace-all safe.directory $GITHUB_WORKSPACE
- name: Get checkout token - name: Get checkout token
uses: actions/create-github-app-token@v1 uses: actions/create-github-app-token@v1
@ -43,6 +42,8 @@ jobs:
- name: Setup build environment - name: Setup build environment
uses: ./.github/actions/setup-haxe uses: ./.github/actions/setup-haxe
with:
gh-token: ${{ steps.app_token.outputs.token }}
- name: Build game - name: Build game
if: ${{ matrix.target == 'windows' }} if: ${{ matrix.target == 'windows' }}
@ -87,6 +88,7 @@ jobs:
with: with:
submodules: 'recursive' submodules: 'recursive'
token: ${{ steps.app_token.outputs.token }} token: ${{ steps.app_token.outputs.token }}
persist-credentials: false
- name: Config haxelib - name: Config haxelib
run: | run: |
@ -103,7 +105,8 @@ jobs:
- if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }}
name: Install dependencies name: Install dependencies
run: | run: |
haxelib --global run hmm install git config --global url.https://x-access-token:${{ steps.app_token.outputs.token }}@github.com/.insteadOf https://github.com/
haxelib --global run hmm install -q
- if: ${{ matrix.target != 'html5' }} - if: ${{ matrix.target != 'html5' }}
name: Restore hxcpp cache name: Restore hxcpp cache

View file

@ -28,6 +28,7 @@ echo 'fs.inotify.max_user_instances=1280' | tee -a /etc/sysctl.conf
EOF EOF
ENV DEBIAN_FRONTEND="noninteractive" ENV DEBIAN_FRONTEND="noninteractive"
ENV GIT_TERMINAL_PROMPT="0"
# Prepare APT # Prepare APT
RUN <<EOF RUN <<EOF
@ -70,6 +71,8 @@ RUN <<EOF
cat <<EOC >> /etc/gitconfig cat <<EOC >> /etc/gitconfig
[safe] [safe]
directory = * directory = *
[credential]
helper = cache
EOC EOC
ssh-keyscan -t rsa,ecdsa,ed25519 github.com >> /etc/ssh/ssh_known_hosts ssh-keyscan -t rsa,ecdsa,ed25519 github.com >> /etc/ssh/ssh_known_hosts