Mapbox iOS SDK in Xcode Cloud CI

So I have a problem setting up Xcode Cloud workflow. I have a Mapbox SDK in my project and in order for spm to install Mapbox SDK it needs to have password in the .netrc file.

I have a ci_post_clone script which looks like this:

touch ~/.netrc

echo "machine api.mapbox.com\n\
  login mapbox\n\
  password MY_TOKEN" >\
~/.netrc

It successfully runs: But when it tries to resolve the packages it fails due to Mapbox not being able to find the password in .netrc file for some reason.

I guess the .netrc file can be edited by using sudo only, but there should be a workaround, if you know of some please help!

I understand that it's not quite an error of Xcode cloud but I think there should be a way to edit .netrc in the workflow.

Thank you!

I think your shellscript is not quite right. I was able to make this work using the script below, which I modified from yours:

#!/bin/bash

touch ~/.netrc

echo "machine api.mapbox.com" > ~/.netrc
echo "login mapbox" >> ~/.netrc 
echo "password ${MAPBOX_TOKEN}" >> ~/.netrc

You need to set the MAPBOX_TOKEN in your workflow environment (unless you want it in your source code).

Have you try to chmod after creating the file?

chmod 600 $HOME/netrc

ref: https://www.ibm.com/docs/en/aix/7.3?topic=customization-creating-netrc-file

Mapbox iOS SDK in Xcode Cloud CI
 
 
Q