Skip to content

Commit

Permalink
modified: .github/workflows/master-push
Browse files Browse the repository at this point in the history
- Update to use expect script for login and publish cheat codes
new file:   scripts/soldeer_publish.expect
- Expect script to manipulate and use the very manual process of using
  soldeer login and push
  • Loading branch information
F-WRunTime committed Oct 7, 2024
1 parent 9933b3f commit 0be69de
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/master-push
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -22,4 +28,12 @@ jobs:
run: |
set -x
short_sha=$(git rev-parse --short ${{ github.sha }})
gh release create ${short_sha} --target ${{ github.sha }}
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'
57 changes: 57 additions & 0 deletions scripts/soldeer_publish.expect
Original file line number Diff line number Diff line change
@@ -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 <email> <password>"
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

0 comments on commit 0be69de

Please sign in to comment.