-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
* refactor queries to require user_id from telegram * regenerate sqlx meta
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Shuttle Deploy Action | ||
|
||
This action automates the deployment of a Rust project to [Shuttle](https://www.shuttle.rs/). This action deploys the project to Shuttle, which builds it and hosts it. This action is a clone of the official deployment action, but having a `keep-alive` flag on deploy. | ||
|
||
Note that you need to have created a project on Shuttle before you can deploy to it. This action will NOT create a new project for you. | ||
You can see the documentation on how to create a project [here](https://docs.shuttle.rs/introduction/quick-start). | ||
|
||
Shuttle Secrets are not handled by this action (yet). Add secrets using Secrets.toml with a manual deploy command. Read more about secrets [here](https://docs.shuttle.rs/resources/shuttle-secrets). | ||
|
||
## Inputs | ||
|
||
| Name | Description | Required | Default | | ||
|-----------------------| --- | --- | --- | | ||
| deploy-key | The Shuttle API key | true | N/A | | ||
| cargo-shuttle-version | Version of cargo-shuttle | false | `""` (latest) | | ||
| working-directory | The directory which includes the `Cargo.toml` | false | `"."` | | ||
| name | The directory which includes the `Cargo.toml` | false | `"."` | | ||
| allow-dirty | Allow uncommitted changes to be deployed | false | `"false"` | | ||
| no-test | Don't run tests before deployment | false | `"false"` | | ||
| secrets | Content of the `Secrets.toml` file, if any | false | `""` | | ||
| keep-alive | Whether service should be kept alive. | false | `"true"` | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
| --- | --- | | ||
<!-- | shuttle-url | The URL of the deployed project | --> | ||
|
||
## Example usage | ||
|
||
### Typical Example | ||
|
||
```yaml | ||
name: Shuttle Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: shuttle-hq/deploy-action@main | ||
with: | ||
deploy-key: ${{ secrets.SHUTTLE_DEPLOY_KEY }} | ||
``` | ||
### Example with all inputs | ||
```yaml | ||
name: Shuttle Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: shuttle-hq/deploy-action@main | ||
with: | ||
deploy-key: ${{ secrets.SHUTTLE_DEPLOY_KEY }} | ||
working-directory: "backend" | ||
name: "my-project" | ||
allow-dirty: "true" | ||
no-test: "true" | ||
cargo-shuttle-version: "0.21.0" | ||
secrets: | | ||
MY_AWESOME_SECRET_1 = '${{ secrets.SECRET_1 }}' | ||
MY_AWESOME_SECRET_2 = '${{ secrets.SECRET_2 }}' | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Shuttle Deploy | ||
description: Deploy to Shuttle | ||
|
||
inputs: | ||
deploy-key: | ||
description: 'The key found at "https://www.shuttle.rs/login"' | ||
required: true | ||
cargo-shuttle-version: | ||
description: "Version of cargo-shuttle" | ||
required: false | ||
default: "" | ||
working-directory: | ||
description: "The directory which includes the `Cargo.toml`" | ||
required: false | ||
default: "." | ||
name: | ||
description: "Name of the project (overrides crate name & Shuttle.toml)" | ||
required: false | ||
default: "" | ||
allow-dirty: | ||
description: "Allow uncommitted changes to be deployed" | ||
required: false | ||
default: "false" | ||
no-test: | ||
description: "Don't run tests before deployment" | ||
required: false | ||
default: "false" | ||
secrets: | ||
description: | | ||
Content of the `Secrets.toml` file, if any. | ||
Use multiline text with `|` in case of multiple secrets | ||
required: false | ||
default: "" | ||
keep-alive: | ||
description: Whether service should be kept alive. | ||
required: false | ||
default: "true" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
# check out repo if not done already | ||
- id: check-repo-is-not-initialized | ||
run: echo "remote-url=$( git config --get remote.origin.url )" >> $GITHUB_OUTPUT | ||
shell: bash | ||
- uses: actions/checkout@v3 | ||
if: ${{ !contains(steps.check-repo-is-not-initialized.outputs.remote-url, github.repository) }} | ||
|
||
# install with cargo-binstall | ||
- name: Install cargo-binstall | ||
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash | ||
shell: bash | ||
- name: Install cargo-shuttle | ||
if: ${{ inputs.cargo-shuttle-version == '' }} | ||
run: cargo binstall -y --locked cargo-shuttle | ||
shell: bash | ||
- name: Install cargo-shuttle ${{ inputs.cargo-shuttle-version }} | ||
if: ${{ inputs.cargo-shuttle-version != '' }} | ||
run: cargo binstall -y --locked cargo-shuttle@${{ inputs.cargo-shuttle-version }} | ||
shell: bash | ||
|
||
- name: Create secret file | ||
if: ${{ inputs.secrets != '' }} | ||
run: echo "${{ inputs.secrets }}" > Secrets.toml | ||
working-directory: ${{ inputs.working-directory }} | ||
shell: bash | ||
|
||
- name: Deploy to Shuttle | ||
run: | | ||
cargo shuttle deploy \ | ||
$(if [ "${{ inputs.name }}" != "" ]; then echo "--name ${{ inputs.name }}"; fi) \ | ||
$(if [ "${{ inputs.allow-dirty }}" != "false" ]; then echo --allow-dirty; fi) \ | ||
$(if [ "${{ inputs.no-test }}" != "false" ]; then echo --no-test; fi) \ | ||
$(if [ "${{ inputs.keep-alive }}" != "false" ]; then echo --idle-minutes 0; fi) \ | ||
| awk '!/Database URI.*?$/' | ||
working-directory: ${{ inputs.working-directory }} | ||
env: | ||
SHUTTLE_API_KEY: ${{ inputs.deploy-key }} | ||
shell: bash |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Add migration script here | ||
ALTER TABLE users | ||
ADD COLUMN telegram_userid BIGINT NOT NULL DEFAULT 0; | ||
ALTER TABLE users | ||
ALTER COLUMN telegram_userid DROP DEFAULT; |