Update devcontainer portion of install to be more robust #195
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "test-install" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
GREEN: '\033[0;32m' | |
NC: '\033[0m' | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup ssh | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Install | |
run: | | |
mkdir -p ~/.ssh | |
chmod 700 ~/.ssh | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
# Update known hosts within the container (recommended) | |
echo -e "${GREEN}Update known hosts${NC}" | |
ssh-keyscan -H github.com >> ~/.ssh/known_hosts | |
docker run --rm \ | |
-v ${{ github.workspace }}:/workspace \ | |
-v ~/.ssh:/home/builduser/.ssh \ | |
-e SSH_AUTH_SOCK=/ssh-agent \ | |
manjarolinux/base:latest \ | |
/bin/bash -c " | |
echo -e '${GREEN}Install openssh and git${NC}' | |
pacman -Sy --noconfirm openssh git go && \ | |
echo -e '${GREEN}Add /workspace to trusted repos${NC}' | |
git config --global --add safe.directory /workspace && \ | |
echo -e '${GREEN}Create builduser${NC}' && \ | |
useradd builduser -m && \ | |
passwd -d builduser && \ | |
printf 'builduser ALL=(ALL) ALL\n' | tee -a /etc/sudoers && \ | |
chown builduser:builduser -R /home/builduser && \ | |
echo -e '${GREEN}Start install${NC}' && \ | |
cd /workspace && \ | |
sudo -u builduser ./install.sh | |
" | |
devcontainer: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04] | |
env: | |
DEV_WORKSPACE: "/workspace" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: install | |
run: ./install.sh |