1name: 'Expo Git Decrypt' 2description: 'Composite action to perform git secrets decryption.' 3 4inputs: 5 key: 6 description: 'An encrypted git key.' 7 required: true 8 9runs: 10 using: 'composite' 11 steps: 12 # OS labels for runners has been taken from docs: 13 # * https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context 14 - name: Install git-crypt on Linux 15 if: ${{ runner.os == 'Linux' }} 16 shell: bash 17 run: sudo apt-get install git-crypt 18 - name: Install git-crypt on macOS 19 if: ${{ runner.os == 'macOS' }} 20 shell: bash 21 run: brew install git-crypt 22 - name: Decrypt secrets if possible 23 env: 24 GIT_CRYPT_KEY_BASE64: ${{ inputs.key }} 25 shell: bash 26 run: | 27 if [[ ${GIT_CRYPT_KEY_BASE64:-unset} = unset ]]; then 28 echo 'git-crypt key not present in environment' 29 else 30 git crypt unlock <(echo $GIT_CRYPT_KEY_BASE64 | base64 --decode) 31 fi 32