Skip to content

Commit

Permalink
Add README and GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
imchairmanm committed Apr 12, 2024
1 parent a07812b commit d6b7ae3
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 39 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/autocommit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Keep Repository Active

on:
schedule:
- cron: '0 0 */28 * *'

jobs:
create-empty-commit:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main

- name: Configure Git
run: |
git config user.name 'Automatic action'
git config user.email '[email protected]'
- name: Create an empty commit and push
run: |
git commit --allow-empty -m "Automated empty commit to keep repo active" -m "This commit is generated automatically every few weeks to prevent GitHub Actions from being disabled due to inactivity."
git push origin main
20 changes: 20 additions & 0 deletions .github/workflows/cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Cleanup Koyeb application

on:
delete:
branches:
- '*'

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Install and configure the Koyeb CLI
uses: koyeb-community/install-koyeb-cli@v2
with:
api_token: "${{ secrets.KOYEB_EXAMPLES_APPS_TOKEN }}"

- name: Cleanup Koyeb application
uses: koyeb/action-git-deploy/cleanup@v1
with:
app-name: astro-${{ github.event.ref }}
28 changes: 28 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build and deploy the application to Koyeb

on:
schedule:
- cron: '20 9 * * *'
push:
branches:
- '*'

jobs:
deploy:
concurrency:
group: "${{ github.ref_name }}"
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: Install and configure the Koyeb CLI
uses: koyeb-community/install-koyeb-cli@v2
with:
api_token: "${{ secrets.KOYEB_EXAMPLES_APPS_TOKEN }}"

- name: Build and deploy the application
uses: koyeb/action-git-deploy@v1
with:
app-name: astro-${{ github.ref_name }}
service-ports: "8000:http"
service-routes: "/:8000"
skip-cache: true
88 changes: 49 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,64 @@
# Astro Starter Kit: Basics
[![example-astro](https://github.com/koyeb/example-astro/actions/workflows/deploy.yaml/badge.svg)](https://github.com/koyeb/example-astro/actions)

```sh
npm create astro@latest -- --template basics
```
<div align="center">
<a href="https://koyeb.com">
<img src="https://www.koyeb.com/static/images/icons/koyeb.svg" alt="Logo" width="80" height="80">
</a>
<h3 align="center">Koyeb Serverless Platform</h3>
<p align="center">
Deploy an Astro application on Koyeb
<br />
<a href="https://koyeb.com">Learn more about Koyeb</a>
Β·
<a href="https://koyeb.com/docs">Explore the documentation</a>
Β·
<a href="https://koyeb.com/tutorials">Discover our tutorials</a>
</p>
</div>

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/basics)
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/basics/devcontainer.json)

> πŸ§‘β€πŸš€ **Seasoned astronaut?** Delete this file. Have fun!
## About Koyeb and the Astro example application

![just-the-basics](https://github.com/withastro/astro/assets/2244813/a0a5533c-a856-4198-8470-2d67b1d7c554)
Koyeb is a developer-friendly serverless platform to deploy apps globally. No-ops, servers, or infrastructure management. This repository contains an Astro application you can deploy on the Koyeb serverless platform for testing.

## πŸš€ Project Structure
This example application is designed to show how an Astro application can be built and deployed on Koyeb. The application consists of the basic default application generated by the `npm create astro@lastest` command. The repository uses the [Node.js SSR adapter](https://docs.astro.build/en/guides/integrations-guide/node/) to serve the project.

Inside of your Astro project, you'll see the following folders and files:
## Getting Started

```text
/
β”œβ”€β”€ public/
β”‚ └── favicon.svg
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ components/
β”‚ β”‚ └── Card.astro
β”‚ β”œβ”€β”€ layouts/
β”‚ β”‚ └── Layout.astro
β”‚ └── pages/
β”‚ └── index.astro
└── package.json
```
Follow the steps below to deploy and run the Astro application on your Koyeb account.

Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
### Requirements

There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
You need a Koyeb account to successfully deploy and run this application. If you don't already have an account, you can sign-up for free [here](https://app.koyeb.com/auth/signup).

Any static assets, like images, can be placed in the `public/` directory.
### Deploy using the Koyeb button

## 🧞 Commands
The fastest way to deploy the Astro application is to click the **Deploy to Koyeb** button below.

All commands are run from the root of the project, from a terminal:
[![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?name=example-astro&type=git&repository=koyeb%2Fexample-astro&branch=main&builder=buildpack)

| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |
Clicking on this button brings you to the Koyeb App creation page with everything pre-set to launch this application.

## πŸ‘€ Want to learn more?
_To modify this application example, you will need to fork this repository. Checkout the [fork and deploy](#fork-and-deploy-to-koyeb) instructions._

Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
## Fork and deploy to Koyeb

If you want to customize and enhance this application, you need to fork this repository.

If you used the **Deploy to Koyeb** button, you can simply link your service to your forked repository to be able to push changes. Alternatively, you can manually create the application as described below.

On the [Koyeb Control Panel](//app.koyeb.com/apps), on the **Overview** tab, click the **Create Web Service** button to begin.

1. Select **GitHub** as the deployment method.
2. In the repositories list, select the repository you just forked.
3. Choose a name for your App and Service, i.e `astro-on-koyeb`, and click **Deploy**.

You will be taken to the deployment page where you can follow the build of your Astro application. Once the build is completed, your application will be deployed and you will be able to access it via `<YOUR_APP_NAME>-<YOUR_ORG_NAME>.koyeb.app`.

## Contributing

If you have any questions, ideas or suggestions regarding this application sample, feel free to open an [issue](https://github.com/koyeb/example-astro/issues) or fork this repository and open a [pull request](https://github.com/koyeb/example-astro/pulls).

## Contact

[Koyeb](https://www.koyeb.com) - [@gokoyeb](https://twitter.com/gokoyeb) - [Slack](http://slack.koyeb.com/)

0 comments on commit d6b7ae3

Please sign in to comment.