luckyframework / luckyframework/website
Add a guide on deploying through Github Actions
Nobody has claimed this yet.
- Dominant language
- Crystal
- Stars
- 39
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
I have several apps that now deploy through Github actions. The config setup will change based on where you're deploying, but we can use this overall structure for a starter template to guide people.
```yaml
name: PROJECT_NAME Deploy
on:
push:
branches:
- production
jobs:
PROJECT_NAME:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: CRYSTAL_VERSION
- name: Cache Node modules
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Cache App Binary
uses: actions/cache@v4
with:
path: |
./bin
./public
key: ${{ github.sha }}-app
- name: Copy .env
run: |
cp .env.production .env
- name: Build Assets
env:
NODE_OPTIONS: --max_old_space_size=4096 --openssl-legacy-provider
run: |
yarn
yarn prod
- name: Build App
run: |
shards build PROJECT_NAME --production --release --skip-postinstall --skip-executables
worker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: CRYSTAL_VERSION
- name: Cache Worker Binary
uses: actions/cache@v4
with:
path: ./bin/worker
key: ${{ github.sha }}-worker
- name: Build Worker
run: |
shards build worker --production --release --skip-postinstall --skip-executables
deploy:
runs-on: ubuntu-latest
needs: [PROJECT_NAME, worker]
steps:
- uses: actions/checkout@v4
- name: Cache App Binary
uses: actions/cache@v4
with:
path: |
./bin
./public
key: ${{ github.sha }}-app
- name: Cache Worker Binary
uses: actions/cache@v4
with:
path: ./bin/worker
key: ${{ github.sha }}-worker
- name: Stage Deployment Files
run: |
echo 'setup your application for deployment'
- name: Get timestamp
uses: gerred/actions/current-time@master
id: current-time
- name: Run string replace
uses: frabert/replace-string-action@master
id: format-time
with:
pattern: '[:\.]+'
string: "${{ steps.current-time.outputs.time }}"
replace-with: "-"
flags: "g"
- name: Deploy files
run: |
echo 'run your deployment code here'
- name: Deployed successfully!
run: echo 'App deploy complete'
```
The guide could even show an example of deploying to a staging environment and building out a seeds binary using some custom compile flags like `-Dstaging`.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the proposed GitHub Actions YAML template in the issue and locate the website's documentation entry point for deployment guidance. Shape the guide around the app, worker, and deploy jobs, and include the suggested staging environment and seeds binary example with custom compile flags. Done means the guide explains the overall structure without assuming one deployment provider.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal, github-actions
- Domain
- devops, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100