diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d44b6e4..e0f4102 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,10 @@ on: type: string required: false default: test + elixir-code-path: + type: string + required: false + default: "." secrets: HEX_ORGANIZATION_COINGAMING_KEY: required: true @@ -65,19 +69,19 @@ jobs: with: ref: ${{ inputs.ref }} submodules: recursive - token: ${{ secrets.GH_TOKEN }} + #token: ${{ secrets.GH_TOKEN || github.token }} - name: Init Deps Cache uses: actions/cache/restore@v3 id: deps-cache with: - key: v2-release-${{ hashFiles('./mix.lock') }}-${{ inputs.mix-env }} + key: v2-release-${{ hashFiles(format('./{0}/mix.lock', inputs.elixir-code-path)) }}-${{ inputs.mix-env }} path: | ${{ inputs.cache_paths }} ~/.mix ~/.hex - ./deps - ./_build + ./${{ inputs.elixir-code-path }}/deps + ./${{ inputs.elixir-code-path }}/_build - name: Init Code Cache uses: actions/cache/restore@v3 @@ -88,8 +92,8 @@ jobs: ${{ inputs.cache_paths }} ~/.mix ~/.hex - ./deps - ./_build + ./${{ inputs.elixir-code-path }}/deps + ./${{ inputs.elixir-code-path }}/_build - name: SSH Deploy Keys Setup uses: cardoe/ssh-agent-deploy-key@v1 @@ -102,11 +106,15 @@ jobs: - name: Add coingaming organization if: steps.deps-cache.outputs.cache-hit != 'true' && steps.code-cache.outputs.cache-hit != 'true' - run: mix hex.organization auth coingaming --key ${{secrets.HEX_ORGANIZATION_COINGAMING_KEY}} + run: | + cd ${{ inputs.elixir-code-path }} + mix hex.organization auth coingaming --key ${{secrets.HEX_ORGANIZATION_COINGAMING_KEY}} - name: Add oban repo if: steps.deps-cache.outputs.cache-hit != 'true' && env.OBAN_FINGERPRINT - run: mix hex.repo add oban https://getoban.pro/repo --fetch-public-key ${{env.OBAN_FINGERPRINT}} --auth-key ${{env.OBAN_LICENSE_KEY}} + run: | + cd ${{ inputs.elixir-code-path }} + mix hex.repo add oban https://getoban.pro/repo --fetch-public-key ${{env.OBAN_FINGERPRINT}} --auth-key ${{env.OBAN_LICENSE_KEY}} - name: Authorize github.com env: @@ -119,6 +127,7 @@ jobs: - name: Get deps and protobuf escript if: steps.deps-cache.outputs.cache-hit != 'true' && steps.code-cache.outputs.cache-hit != 'true' run: | + cd ${{ inputs.elixir-code-path }} mix deps.get mix escript.install hex protobuf 0.10.0 --force echo "$HOME/.mix/escripts" >> $GITHUB_PATH @@ -130,28 +139,34 @@ jobs: - name: Compile dependencies if: steps.deps-cache.outputs.cache-hit != 'true' && steps.code-cache.outputs.cache-hit != 'true' - run: mix deps.compile + run: | + cd ${{ inputs.elixir-code-path }} + mix deps.compile - name: Download UAInspector DB if: steps.deps-cache.outputs.cache-hit != 'true' && steps.code-cache.outputs.cache-hit != 'true' - run: mix run --no-start -e "UAInspector.Downloader.download()" + run: | + cd ${{ inputs.elixir-code-path }} + mix run --no-start -e "UAInspector.Downloader.download()" continue-on-error: true - name: Save Deps Cache uses: actions/cache/save@v3 if: steps.deps-cache.outputs.cache-hit != 'true' with: - key: v2-release-${{ hashFiles('./mix.lock') }}-${{ inputs.mix-env }} + key: v2-release-${{ hashFiles(format('./{0}/mix.lock', inputs.elixir-code-path)) }}-${{ inputs.mix-env }} path: | ${{ inputs.cache_paths }} ~/.mix ~/.hex - ./deps - ./_build + ./${{ inputs.elixir-code-path }}/deps + ./${{ inputs.elixir-code-path }}/_build - name: Compile if: steps.code-cache.outputs.cache-hit != 'true' - run: mix compile + run: | + cd ${{ inputs.elixir-code-path }} + mix compile - name: Save Code Cache uses: actions/cache/save@v3 @@ -162,5 +177,5 @@ jobs: ${{ inputs.cache_paths }} ~/.mix ~/.hex - ./deps - ./_build + ./${{ inputs.elixir-code-path }}/deps + ./${{ inputs.elixir-code-path }}/_build