|
| 1 | +<p align="center"> |
| 2 | + <br /> |
| 3 | + <img width="200" src="../../assets/cdwr-cloud.png" alt="codeware sthlm logo"> |
| 4 | + <br /> |
| 5 | + <br /> |
| 6 | +</p> |
| 7 | + |
| 8 | +<h1 align='center'>Nx Fly Deployment Action</h1> |
| 9 | + |
| 10 | +<p align='center'> |
| 11 | + GitHub action that brings automatic <a href='https://fly.io'>Fly.io</a> deployments to your <a href='https://nx.dev'>Nx</a> workspace. |
| 12 | + <br /> |
| 13 | + <br /> |
| 14 | + <a href='https://www.npmjs.com/package/@cdwr/nx-fly-deployment-action'><img src='https://img.shields.io/npm/v/@cdwr/nx-fly-deployment-action?label=npm%20version' alt='@cdwr/nx-fly-deployment-action npm'></a> |
| 15 | + |
| 16 | + <a href='https://opensource.org/licenses/MIT'><img src='https://img.shields.io/badge/License-MIT-green.svg' alt='MIT'></a> |
| 17 | + <br /> |
| 18 | + <br /> |
| 19 | +</p> |
| 20 | + |
| 21 | +## Description |
| 22 | + |
| 23 | +This action will manage deployments to [Fly.io](https://fly.io) of your [Nx](https://nx.dev) workspace applications. |
| 24 | + |
| 25 | +## Usage |
| 26 | + |
| 27 | +> [!IMPORTANT] |
| 28 | +> Using the action is currently limited to cloning this repository since the package isn't deployed according to action best practices. |
| 29 | +> |
| 30 | +> We have a monorepo and are considering other options to make the action available to other repositories. |
| 31 | +
|
| 32 | +```yaml |
| 33 | +- uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + fetch-depth: 0 |
| 36 | + |
| 37 | +# Install dependencies and tools... |
| 38 | +# Build 'fly-deployment-action' package... |
| 39 | + |
| 40 | +# Fly CLI must be installed |
| 41 | +- name: Install Fly CLI |
| 42 | + uses: superfly/flyctl-actions/setup-flyctl@master |
| 43 | + with: |
| 44 | + version: 0.3.45 |
| 45 | + |
| 46 | +# Let Nx analyze which projects are affected and hence will be deployed |
| 47 | +- name: Analyze affected projects to deploy |
| 48 | + uses: nrwl/nx-set-shas@v4 |
| 49 | + with: |
| 50 | + set-environment-variables-for-job: true |
| 51 | + |
| 52 | +- name: Run Nx Fly Deployment |
| 53 | + uses: ./packages/nx-fly-deployment-action |
| 54 | + with: |
| 55 | + fly-api-token: ${{ secrets.FLY_API_TOKEN }} |
| 56 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 57 | +``` |
| 58 | +
|
| 59 | +### Outputs |
| 60 | +
|
| 61 | +The action will output the following variables: |
| 62 | +
|
| 63 | +- `environment`: The environment used for deployment. |
| 64 | +- `destroyed`: A list of project names that were destroyed. |
| 65 | +- `skipped`: A list of project names that were skipped for some reason. |
| 66 | +- `deployed`: JSON object containing the deployed project names and their urls. |
0 commit comments