├── CHANGELOG.md ├── LICENSE ├── README.md └── action.yml /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 3 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 4 | 5 | ## [`Unreleased`] 6 | - Add _Known Issues_ to the docs 7 | 8 | ## [`1.0.1`] - 2021-08-12 9 | ### Added 10 | - Optional arguments: 11 | - `deta-project-dir`: The name of the directory where the Deta code is located, in cases where the project is not located in the root directory. Default `.` _(the root)_. PR [#2](https://github.com/BogDAAAMN/deta-deploy-action/pull/2) 12 | 13 | ## [`1.0.0`] - 2020-12-08 14 | ### Added 15 | - Deployment to Deta Micro 16 | - Required arguments: 17 | - `deta-access-token`: The access token generated by Deta. Used for `deta clone` and `deta deploy` commands. 18 | - `deta-name`: The name of the existing Deta Micro you are deploying to. Used for `deta clone` command in order to retrieve the latest information about the targeted Micro. 19 | - Optional arguments: 20 | - `deta-project`: The name of the Deta project your Micro is part of. Used for `deta clone` command in order to retrieve the latest information about the targeted Micro. Default `"default"`. 21 | 22 | [`Unreleased`]: https://github.com/BogDAAAMN/deta-deploy-action/tree/main 23 | [`1.0.0`]: https://github.com/BogDAAAMN/deta-deploy-action/releases/tag/v1.0.0 24 | [`1.0.1`]: https://github.com/BogDAAAMN/deta-deploy-action/releases/tag/v1.0.1 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Bogdan Covrig 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > ⚠️ **Deta Cloud** as been sunset since Thursday, June 1st, 2023 at 11:59 PM. Unfortunately this project will not be maintained to support Deta Space instead. Read more about it here https://deta.space/migration/introduction 2 | > 3 | > There is yet one community maintained GitHub Action for Space at [space-deployment-github-action](https://github.com/neobrains/space-deployment-github-action). Otherwise checkout or ask for help on Discord https://go.deta.dev/discord 4 | 5 | # Deploy to Deta Micro 6 | 7 |
8 | Lots of thanks to the BotCom folks for clarification and to the Deta folks and for all the walkthroughs and hard work! 💕 9 |
10 | 11 | 14 | 15 | ## Usage 16 | 17 | This is a simple GitHub Action to deploy current repo to a Deta Micro. Uses `deta deploy` command to deploy the latest changes as per [documentation](https://docs.deta.sh/docs/cli/commands/#deta-deploy). 18 | 19 | ## Inputs 20 | 21 | ### `deta-access-token` 22 | 23 | **Required**. The access token generated by Deta. Used for `deta clone` and `deta deploy` commands. 24 | 25 | You can generate your own access token from your [Deta account](https://web.deta.sh/home/) in order to avoid web login. Follow the Authetication documentation [here](https://docs.deta.sh/docs/cli/auth). 26 | 27 | ⚠️ Be **very** sure you don't share the token or paste it in plain text! You can add it to the GitHub project's secrets as it follows: 28 | 29 | - On your project's page click on the **Settings** button; 30 | - Navigate to **Secrets** panel; 31 | - Click on **New secret**; 32 | - Name it `DETA_TOKEN` and paste the key there. 33 | 34 | Now you can use the key in your project's actions as `${{ secrets.DETA_TOKEN }}`. Read more about [GitHub Secrets](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets). 35 | 36 |  37 | 38 | ### `deta-name` 39 | 40 | **Required**. The name of the existing Deta Micro you are deploying to. Used for `deta clone` command in order to retrieve the latest information about the targeted Micro. 41 | 42 | ### `deta-project` 43 | 44 | The name of the Deta project your Micro is part of. Used for `deta clone` command in order to retrieve the latest information about the targeted Micro. Default `"default"`. 45 | 46 | ### `deta-project-dir` 47 | 48 | The name of the directory where the Deta code is located, in cases where the project is not located in the root directory. Default `.` (the root) 49 | 50 | ## Example action workflow 51 | 52 | ```yaml 53 | name: Deploy to Deta 54 | on: push 55 | 56 | jobs: 57 | deploy: 58 | runs-on: ubuntu-latest 59 | steps: 60 | - uses: actions/checkout@v2 #Be sure you check-out the repo first. Deta CLI needs access to the files 61 | - uses: BogDAAAMN/deta-deploy-action@v1.0.1 62 | with: 63 | deta-access-token: ${{ secrets.DETA_TOKEN }} #Deta access token https://docs.deta.sh/docs/cli/auth 64 | deta-name: 'micro-name' #Deta Micro name https://docs.deta.sh/docs/cli/commands/#deta-clone 65 | deta-project: 'project-name' #Optional: Deta project name https://docs.deta.sh/docs/cli/commands/#deta-clone 66 | deta-project-dir: 'other-dir' #Optional: directory to be deployed on Deta. Default is the root "." 67 | ``` 68 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: "Deploy to Deta" 2 | description: "Simple GitHub Action to deploy current repo to a Deta Micro" 3 | 4 | inputs: 5 | deta-access-token: 6 | description: "Deta access token" 7 | required: true 8 | deta-name: 9 | description: "Deta micro name" 10 | required: true 11 | deta-project: 12 | description: "Deta project name" 13 | default: "default" 14 | deta-project-dir: 15 | description: "Directory of the project" 16 | default: "." 17 | 18 | runs: 19 | using: "composite" 20 | steps: 21 | # Install Deta CLI as per docs 22 | # https://docs.deta.sh/docs/cli/install 23 | - name: Install Deta CLI 24 | shell: bash 25 | run: | 26 | curl -fsSL https://get.deta.dev/cli.sh | sh 27 | 28 | # Using the access token and existing Deta micro and project, 29 | # clone the micro and copy .deta metadata folder to use it in deploy 30 | # https://docs.deta.sh/docs/cli/commands#deta-clone 31 | - name: Clone Deta Metadata 32 | shell: bash 33 | run: | 34 | export DETA_ACCESS_TOKEN=${{ inputs.deta-access-token }} 35 | cd ${{ inputs.deta-project-dir }} 36 | ~/.deta/bin/deta clone --name ${{ inputs.deta-name }} --project ${{ inputs.deta-project }} tmp/ 37 | cp -r tmp/.deta . 38 | 39 | # Using the access token, deploy the project to Deta 40 | # https://docs.deta.sh/docs/cli/commands#deta-deploy 41 | - name: Deploy to Deta 42 | shell: bash 43 | run: | 44 | export DETA_ACCESS_TOKEN=${{ inputs.deta-access-token }} 45 | cd ${{ inputs.deta-project-dir }} 46 | ~/.deta/bin/deta deploy 47 | 48 | branding: 49 | icon: check-circle 50 | color: purple 51 | --------------------------------------------------------------------------------