While using Github Actions, I'm facing "Permission denied error"

Viewed 670

I'm working with Github actions lately and facing trouble while importing .p12 certificate to build.keychain and getting error as follows:

/Users/runner/work/_temp/47c4b40a-b302-4da8-a26c-562eaae4c0ee.sh: line 1: ./provisioning/import_provisioning.sh: Permission denied
Error: Process completed with exit code 1.

After struggling for many hours I even tried to run this script manually on my terminal and everything seems to be working fine! I rechecked whether my passwords are wrong or whether i'm not able to access it or not! But i think i able to access my github secret properly, Any Idea why this may happening!

Here is my shell script file import_provisioning.sh

gpg --quiet --batch --yes --decrypt --passphrase="$PROVISIONING_PASSWORD" --output provisioning/AppStoreCertificates.p12 provisioning/AppStoreCertificates.p12.gpg
gpg --quiet --batch --yes --decrypt --passphrase="$PROVISIONING_PASSWORD" --output provisioning/demo.mobileprovision provisioning/demo.mobileprovision.gpg

mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles

echo "List profiles"
ls ~/Library/MobileDevice/Provisioning\ Profiles/
echo "Move profiles"
cp provisioning/*.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
echo "List profiles"
ls ~/Library/MobileDevice/Provisioning\ Profiles/

security create-keychain -p "" build.keychain
security import provisioning/AppStoreCertificates.p12 -t agg -k ~/Library/Keychains/build.keychain -P "$PROVISIONING_PASSWORD" -A

security list-keychains -s ~/Library/Keychains/build.keychain
security default-keychain -s ~/Library/Keychains/build.keychain
security unlock-keychain -p "" ~/Library/Keychains/build.keychain
security set-key-partition-list -S apple-tool:,apple: -s -k "" ~/Library/Keychains/build.keychain

And just in case you're not getting it properly you can check github repo for reference https://github.com/dheerajghub/GithubPipeline/blob/master/provisioning/import_provisioning.sh

1 Answers

I just found out that the problem was in the file permission so i set file permission and everything thing seems to be working fine!

git update-index --chmod=+x provisioning/import_provisioning.sh
git commit -m "Changing file permissions"
Related