diff --git a/.github/workflows/master-push b/.github/workflows/master-push index 8d11c95..2f145a3 100644 --- a/.github/workflows/master-push +++ b/.github/workflows/master-push @@ -8,8 +8,14 @@ jobs: cut-release: name: 'Cut Release' - runs-on: [self-hosted, linux, flyweight] + runs-on: ubuntu-latest steps: + - name: 'Install expect' + run: sudo apt-get update && sudo apt-get install -y expect + + - name: 'Run Expect Script' + run: expect scripts/soldeer_publish.sh ${{ vars.SOLDEER_EMAIL }} ${{ secrets.SOLDEER_PASSWORD }} + - name: 'Check out code' uses: actions/checkout@v3 with: @@ -22,4 +28,12 @@ jobs: run: | set -x short_sha=$(git rev-parse --short ${{ github.sha }}) - gh release create ${short_sha} --target ${{ github.sha }} \ No newline at end of file + gh release create ${short_sha} --target ${{ github.sha }} + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: 'Build' + run: cargo install soldeer + + - name: 'Run tests' diff --git a/scripts/soldeer_publish.expect b/scripts/soldeer_publish.expect new file mode 100755 index 0000000..3c4cd5a --- /dev/null +++ b/scripts/soldeer_publish.expect @@ -0,0 +1,57 @@ +#!/usr/bin/expect -f +#################### +# An expect script to handle the manual login and push process for soldeerk +#################### + +# Inherit the user's environment +set env(PATH) $::env(PATH) + +# Check if the correct number of arguments is provided +if { $argc != 2 } { + puts "Usage: $argv0 " + exit 1 +} + +# Assign arguments to variables +set email [lindex $argv 0] +set password [lindex $argv 1] + +# Command to start the login process +set command "forge soldeer login" + +# Full path to the forge command +set command "/home/blueeagle/.foundry/bin/forge soldeer login" + +# Start the login process +spawn bash -c "$command" + +# Wait for the email prompt and send the email +expect "Please enter your email:" +send "$email\r" + +# Wait for the password prompt and send the password +expect "Please enter your password:" +send "$password\r" + +# Wait for the success message +expect { + "Login successful" { + puts "Login successful" + } + "Login failed" { + puts "Login failed" + exit 1 + } +} + +# Wait for the end of the interaction +expect eof + +# Command to push after login +set push_command "forge soldeer push" + +# Start the push process +spawn bash -c "$push_command" + +# Wait for the end of the push interaction +expect eof \ No newline at end of file