work? #50
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: cloudbabbel | |
on: | |
push: | |
workflow_dispatch: | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
build-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Setup SSH Agent | |
uses: webfactory/ssh-agent@v0.5.2 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Set up Public SSH Key | |
run: | | |
path=$(pwd) | |
echo $path | |
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD2ttYO43o1zv0zfixHW4LyZcOF5P3oNWdVespIkE74ouWtSxmLOJW9Hl5k3X4xpA4TeLT5m6tHyc1GRCxgG2YVudOqhf5QD5lOergHPGR+iM4HjnxEFCiNN4FoEPef+l7Bizr6sNQvbkeA2UL7MFNecDgSOtjrO9SBu8S1BboGvIos2kzi+bot+J7w3Zb/XbFWHiCQDT+s7YZb6D7EQ01HCx2UQxnhVez/oxbqVkW4OFMJp7tcK4DU0qWaoZ2//sCVxepYhSqL6biI0JlWN76uksgXAb2oU4x2nCG+80RcypVasv59IFY4tojSmg/q/Y08z40J+XunHXnuiZ3yzsSP root@treehouses" > $path/id_rsa.pub | |
- name: install treehouses | |
run: | | |
#sudo apt update | |
sudo apt install tor | |
sudo npm install -g @treehouses/cli | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v1.7.0 | |
with: | |
role-to-assume: arn:aws:iam::885416451907:role/GitHubAction-AssumeRoleWithAction | |
role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
aws-region: ap-northeast-1 | |
- name: Sts GetCallerIdentity | |
run: | | |
aws sts get-caller-identity | |
aws ec2 describe-key-pairs | |
sudo treehouses sshtunnel key name | |
sudo treehouses sshtunnel key name | cut -d ' ' -f 5 | |
publickey=`sudo treehouses sshtunnel key name | cut -d ' ' -f 5`.pub | |
keyPath=$(pwd) | |
checkSSH=$keyPath/$publickey | |
if test ! -f "$checkSSH"; then | |
echo "Run 'ssh-keygen' first, with an empty passphrase for no passphrase. Missing ssh key." && exit 1 | |
fi | |
echo $checkSSH | |
cat $checkSSH | |
if [[ -f $keyPath/$publickey ]] | |
then | |
sudo aws ec2 import-key-pair --key-name "$keyname" --public-key-material fileb://$checkSSH | |
else | |
echo 'ssh key pair ($keyPath/$publickey) do not exist $keyPath/$publickey' | |
echo 'Please generate the ssh key by the commad "ssh-keygen -t rsa"' | |
exit 1 | |
fi | |
- name: start luftbllon | |
run: | | |
sudo bash init.sh -g | |
- name: open seasame | |
run: | | |
#sudo apt update | |
sudo treehouses tor add 22 | |
sudo treehouses tor | |
sudo treehouses tor notice now | |
sudo treehouses sshkey github adduser dogi | |
sudo treehouses sshkey github adduser hirotochigi | |
echo "shh only dreams" | |
ls -al | |
echo ------------- | |
echo ------------- | |
echo ------------- | |
ls -alR | |
sleep 1200 | |
- name: Cleanup Step | |
if: cancelled() || failure() | |
run: | | |
sudo bash delete.sh luftballon |