Skip to content

Commit

Permalink
feat(GITHUB): add step to apply rendered profile to a machine
Browse files Browse the repository at this point in the history
  • Loading branch information
niall-byrne committed Jun 24, 2021
1 parent 9a0bcba commit fd73a62
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 3 deletions.
37 changes: 37 additions & 0 deletions .github/scripts/apply.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions .github/scripts/template.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash

set -eo pipefail

NAME=${1:-"Pro Buddy Dev"}
EMAIL=${2:-"[email protected]"}

set -eo pipefail

main() {
pip install cookiecutter poetry
git config --global user.name "${NAME}"
Expand Down
41 changes: 40 additions & 1 deletion .github/workflows/self-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit fd73a62

Please sign in to comment.