From ecdb220db8327f8d688aa5968eedd860df3dc082 Mon Sep 17 00:00:00 2001 From: Jake Meyer Date: Sun, 24 Sep 2023 21:04:46 -0700 Subject: [PATCH] bump deps + use ghcr for images --- .github/workflows/ci.yml | 28 ++++++++++++++++++----- .gitignore | 4 +++- Cargo.toml | 8 +++---- fly.toml | 48 ---------------------------------------- 4 files changed, 29 insertions(+), 59 deletions(-) delete mode 100644 fly.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 439778d..1a3f0b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,6 @@ on: [push, pull_request] env: IMAGE_NAME: sandbox-api CARGO_TERM_COLOR: always - FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} jobs: clippy: @@ -52,12 +51,29 @@ jobs: with: command: test - deploy: - name: Deploy + push-image: + name: Push Image runs-on: ubuntu-latest needs: test if: github.ref == 'refs/heads/master' steps: - - uses: actions/checkout@v3 - - uses: superfly/flyctl-actions/setup-flyctl@master - - run: flyctl deploy --local-only + - uses: actions/checkout@v3 + - name: Build image + run: docker build . --file Dockerfile --tag $IMAGE_NAME + - name: Log into registry + run: echo ${{ secrets.PACKAGES_ACCESS_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin + - name: Push image + run: | + IMAGE_ID=ghcr.io/${{ github.repository }} + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # Use Docker `latest` tag convention + [ "$VERSION" == "master" ] && VERSION=latest + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION diff --git a/.gitignore b/.gitignore index c84da1a..391fc84 100644 --- a/.gitignore +++ b/.gitignore @@ -89,4 +89,6 @@ $RECYCLE.BIN/ *.msp # Windows shortcuts -*.lnk \ No newline at end of file +*.lnk + +.vscode \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index ce9bd78..9e260d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,17 +5,17 @@ edition = "2021" [dependencies] anyhow = "1.0.75" -async-stripe = { version = "0.22.2", default-features = false, features = ["runtime-tokio-hyper-rustls", "billing", "connect", "webhook-events", "uuid", "stream", "checkout"] } +async-stripe = { version = "0.23.0", default-features = false, features = ["runtime-tokio-hyper-rustls", "billing", "connect", "webhook-events", "uuid", "stream", "checkout"] } axum = { version = "0.6.20", features = ["http2", "headers"] } -chrono = { version = "0.4.30", features = ["serde"] } +chrono = { version = "0.4.31", features = ["serde"] } dotenvy = "0.15.7" figment = { version = "0.10.10", features = ["env"] } jsonwebtoken = { version = "8.3.0", default-features = false } owasp-headers = "0.1.2" reqwest = { version = "0.11.20", default-features = false, features = ["rustls-tls", "trust-dns"] } -sea-orm = { version = "0.12.2", features = [ "sqlx-postgres", "runtime-tokio-rustls", "macros", "with-json", "with-chrono", "with-uuid" ] } +sea-orm = { version = "0.12.3", features = [ "sqlx-postgres", "runtime-tokio-rustls", "macros", "with-json", "with-chrono", "with-uuid" ] } serde = { version = "1.0.188", features = ["derive"] } -serde_json = "1.0.106" +serde_json = "1.0.107" serde_with = "3.3.0" thiserror = "1.0.48" tokio = { version = "1.32.0", features = ["full"] } diff --git a/fly.toml b/fly.toml deleted file mode 100644 index f44a86f..0000000 --- a/fly.toml +++ /dev/null @@ -1,48 +0,0 @@ -# fly.toml app configuration file generated for sandbox-api on 2023-08-31T17:38:27-07:00 -# -# See https://fly.io/docs/reference/configuration/ for information about how to use this file. -# - -app = "sandbox-api" -primary_region = "ord" -kill_signal = "SIGINT" -kill_timeout = "5s" - -[experimental] - auto_rollback = true - -[build] - -[env] - RUST_LOG = "info" - -[[services]] - protocol = "tcp" - internal_port = 5678 - processes = ["app"] - - [[services.ports]] - port = 80 - handlers = ["http"] - force_https = true - - [[services.ports]] - port = 443 - handlers = ["tls", "http"] - [services.concurrency] - type = "connections" - hard_limit = 200 - soft_limit = 180 - - [[services.tcp_checks]] - interval = "15s" - timeout = "2s" - grace_period = "1s" - - [[services.http_checks]] - interval = "10s" - timeout = "2s" - grace_period = "5s" - method = "get" - path = "/health" - protocol = "http"