Created
September 21, 2022 02:33
-
-
Save jayhuang75/920c367b51dd0d84a08eeec03b52447e to your computer and use it in GitHub Desktop.
rust_serverless_trading_view_github_action
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: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
BUILD_HOME: /home/runner/work/bot/bot | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Prepare env | |
run: sudo apt install musl-tools libssl-dev musl-dev pkgconf | |
- name: Add target | |
run: | | |
rustup target add x86_64-unknown-linux-musl | |
- name: Add SQLX | |
run: | | |
cargo install sqlx-cli --no-default-features --features native-tls,postgres | |
cargo sqlx prepare --database-url ${{ secrets.DATABASE_URL }} | |
- name: Build | |
run: cargo build --release --target x86_64-unknown-linux-musl --bin bootstrap | |
env: | |
SQLX_OFFLINE: true | |
- name: Create .zip file | |
run: | | |
cp $BUILD_HOME/target/x86_64-unknown-linux-musl/release/bootstrap bootstrap | |
zip lambda.zip bootstrap | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: deploy | |
run: | | |
aws lambda update-function-code --function-name=tradingViewCollectorBot --zip-file=fileb://lambda.zip | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment