Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/actions/deploy-dapp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy HathorDice dApp
description: Build and deploy the HathorDice dApp to AWS S3/CloudFront

inputs:
site:
description: The site name to build and deploy (staging, production)
required: true
aws-region:
description: The AWS region to deploy to
required: true
default: us-east-1
aws-role:
description: The AWS IAM role to assume for deployment
required: true

runs:
using: composite
steps:
- name: Configure AWS Credentials
# https://github.com/aws-actions/configure-aws-credentials/releases/tag/v5.1.1
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708
with:
aws-region: ${{ inputs.aws-region }}
role-to-assume: ${{ inputs.aws-role }}

- name: Set up Node.js 24.x
# https://github.com/actions/setup-node/releases/tag/v6.1.0
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
with:
node-version: 24.x

- name: Download node modules
# https://github.com/actions/download-artifact/releases/tag/v6.0.0
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
with:
name: node_modules

- name: Build
shell: bash
run: |
tar -xf node_modules.tar
make build site=${{ inputs.site }}

- name: Deploy
shell: bash
run: |
make sync site=${{ inputs.site }}
make clear_cloudfront_cache site=${{ inputs.site }}
76 changes: 76 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: deploy

on:
push:
branches: [release]
tags: ['v*']

permissions:
id-token: write
contents: read

jobs:
dependencies:
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout/releases/tag/v6.0.1
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8

- name: Set up Node.js 24.x
# https://github.com/actions/setup-node/releases/tag/v6.1.0
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
with:
node-version: 24.x

- name: Cache node modules
# https://github.com/actions/cache/releases/tag/v4.3.0
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
env:
cache-name: cache-node-modules
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: Install Dependencies
run: |
npm install
tar -cvf node_modules.tar ./node_modules

- name: Upload node modules
# https://github.com/actions/upload-artifact/releases/tag/v5.0.0
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: node_modules
path: node_modules.tar
if-no-files-found: error
retention-days: 1

deploy-staging:
if: github.ref == 'refs/heads/release'
needs: dependencies
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout/releases/tag/v6.0.1
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
- uses: ./.github/actions/deploy-dapp
with:
site: staging
aws-region: us-east-1
aws-role: arn:aws:iam::769498303037:role/HathorDiceGitHubActionsRoleStaging

deploy-production:
if: startsWith(github.ref, 'refs/tags/v')
needs: dependencies
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout/releases/tag/v6.0.1
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
- uses: ./.github/actions/deploy-dapp
with:
site: production
aws-region: us-east-1
aws-role: arn:aws:iam::769498303037:role/HathorDiceGitHubActionsRoleProduction
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.PHONY: build
build:
./scripts/deploy.sh $(site) build $(aws_profile)

.PHONY: sync
sync:
./scripts/deploy.sh $(site) sync $(aws_profile)

.PHONY: deploy
deploy: build sync clear_cloudfront_cache

.PHONY: clear_cloudfront_cache
clear_cloudfront_cache:
./scripts/deploy.sh $(site) clear_cache $(aws_profile)
9 changes: 9 additions & 0 deletions next.config.production.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
images: {
unoptimized: true,
},
}

module.exports = nextConfig
38 changes: 26 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading