diff --git a/.github/scripts/apply.sh b/.github/scripts/apply.sh new file mode 100644 index 0000000..20b3a6a --- /dev/null +++ b/.github/scripts/apply.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# shellcheck disable=SC2129 + +set -eo pipefail + +RELEASE_URL="https://github.com/${USERNAME}/mac_maker/releases/download/${RELEASE_VERSION}/mac_maker_${OS_VERSION}_${PLATFORM_VERSION}.tar.gz" +RELEASE_FOLDER="mac_maker_${OS_VERSION}_${PLATFORM_VERSION}" + +apply() { + + ANSIBLE_BECOME_PASSWORD="not needed" + USER="$(id -un)" + HOME="/Users/${USER}" + + pushd "${RELEASE_FOLDER}" || exit 127 + export ANSIBLE_BECOME_PASSWORD USER HOME + ./mac_maker apply github "https://github.com/${USERNAME}/${TEMPLATED_NAME}" + popd + +} + +fetch() { + + curl -L "${RELEASE_URL}" > binary.tar.gz + tar xvzf binary.tar.gz + +} + +main() { + + fetch + apply + +} + +main diff --git a/.github/scripts/template.sh b/.github/scripts/template.sh index 23b33d3..d2da6bf 100644 --- a/.github/scripts/template.sh +++ b/.github/scripts/template.sh @@ -1,10 +1,10 @@ #!/bin/bash +set -eo pipefail + NAME=${1:-"Pro Buddy Dev"} EMAIL=${2:-"somedude@coolstartup.com"} -set -eo pipefail - main() { pip install cookiecutter poetry git config --global user.name "${NAME}" diff --git a/.github/workflows/self-test.yml b/.github/workflows/self-test.yml index d28c793..9c56eec 100644 --- a/.github/workflows/self-test.yml +++ b/.github/workflows/self-test.yml @@ -20,9 +20,48 @@ env: jobs: - create_release: + apply_profile: needs: [push_repository_test] + runs-on: macos-${{ matrix.os }} + strategy: + max-parallel: 4 + matrix: + os: [10.15] + platform: [x86_64] + python-version: [3.8.10] + + steps: + - name: OSX Build -- Checkout Repository + uses: actions/checkout@v2 + with: + path: 'template' + + - name: OSX Build -- Setup Environment + run: | + source ./template/.github/scripts/setup.sh + env: + WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + + - name: OSX Build -- Apply Pushed Profile + run: | + source ./template/.github/scripts/apply.sh + env: + PLATFORM_VERSION: ${{ matrix.platform }} + OS_VERSION: ${{ matrix.os }} + + - name: OSX Build -- Report Job Status (Success) + run: | + ./template/{{cookiecutter.profile_slug}}/.github/scripts/notifications.sh "${NOTIFICATION}" ":white_check_mark: OSX ${{ matrix.os }}, profile install was successful" + + - name: OSX Build -- Report Job Status (Failure) + if: failure() + run: | + ./template/{{cookiecutter.profile_slug}}/.github/scripts/notifications.sh "${NOTIFICATION}" ":x: OSX ${{ matrix.os }}, profile install failed!" + + create_release: + needs: [apply_profile] + runs-on: ubuntu-latest steps: