Skip to content

Commit

Permalink
feat: Added deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
knownasred committed Oct 2, 2024
1 parent a40d600 commit 1c4d0cf
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 55 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/deploy-slot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow will install Deno then run `deno lint` and `deno test`.
# For more information see: https://github.com/denoland/setup-deno

name: Deno

on:
push:
- main
- deployment

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Setup repo
uses: actions/checkout@v4

- id: setup-dojo
uses: runelabsxyz/setup-dojo@main
with:
version: 'v1.0.0-alpha.12'

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Build contract
working-directory: ./contracts
run: sozo build -P slot

- name: Test contract
working-directory: ./contracts
run: sozo test -P slot
if: false # Set this to true when we finally have working tests

- name: Deploy contract
working-directory: ./contracts
run: sozo migrate apply -P slot
env:
DOJO_ACCOUNT_ADDRESS: ${{ secrets.DOJO_ACCOUNT_ADDRESS }}
DOJO_PRIVATE_KEY: ${{ secrets.DOJO_PRIVATE_KEY }}

- name: Install dependencies
working-directory: ./refactor
run: bun install --frozen-lockfile

- name: Build frontend for slot
run: bun run build
working-directory: ./refactor
env:
ENV: slot
CF_PAGES: '1'
# For now, isok, but getting an official file at some point would be nice:
PUBLIC_TORII_URL: https://api.cartridge.gg/x/octoguns-demo/katana
PUBLIC_RPC_URL: https://api.cartridge.gg/x/octoguns-demo/katana
PUBLIC_WORLD_ADDRESS: 0x7447477a7c852c946f0b8d13ebdfe0db9e78f3de60ab799320691502b4d32a3
PUBLIC_BURNER_ADDRESS: 0xe29882a1fcba1e7e10cad46212257fea5c752a4f9b1b1ec683c503a2cf5c8a
PUBLIC_BURNER_KEY: 0x14d6672dcb4b77ca36a887e9a11cd9d637d5012468175829e9c6e770c61642

- name: Deploy to cloudflare pages
working-directory: ./refactor
run: bun wrangler pages deploy

49 changes: 0 additions & 49 deletions .github/workflows/deploy.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.direnv
.direnv
.wrangler
2 changes: 2 additions & 0 deletions contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
target
bindings
.env
manifests/*
3 changes: 1 addition & 2 deletions contracts/dojo_slot.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ default = "octoguns"

[env]
rpc_url = "https://api.cartridge.gg/x/octoguns-public-alpha1/katana"
account_address = "0x9b4fea3bb27903a996426a7bd4cd33a23e1187942cf19c6f7611b4db333bee"
private_key = "0x2a79be0d524b62728aa13f63e180a18224cb6205d78473559ccb94957a23814"
world_address = "0x7447477a7c852c946f0b8d13ebdfe0db9e78f3de60ab799320691502b4d32a3"
Binary file modified refactor/bun.lockb
Binary file not shown.
7 changes: 5 additions & 2 deletions refactor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@types/three": "^0.168.0",
"autoprefixer": "^10.4.20",
"dotenv": "^16.4.5",
"postcss": "^8.4.43",
"svelte": "^4.2.19",
"svelte-check": "^3.8.6",
"tailwindcss": "^3.4.10",
"typescript": "^5.5.4",
"vite": "^5.4.2"
"vite": "^5.4.2",
"wrangler": "^3.79.0"
},
"type": "module",
"dependencies": {
Expand Down Expand Up @@ -51,7 +53,8 @@
"@sveltejs/kit",
"@swc/core",
"esbuild",
"svelte-preprocess"
"svelte-preprocess",
"workerd"
],
"engines": {
"node": ">=20.0.0"
Expand Down
2 changes: 1 addition & 1 deletion refactor/src/dojoConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import manifest from '../../contracts/manifests/dev/deployment/manifest.json';
import manifest from '$manifests/deployment/manifest.json';
import { createDojoConfig } from '@dojoengine/core';

import {PUBLIC_TORII_URL, PUBLIC_RPC_URL, PUBLIC_BURNER_ADDRESS, PUBLIC_BURNER_KEY, PUBLIC_WORLD_ADDRESS} from '$env/static/public';
Expand Down
5 changes: 5 additions & 0 deletions refactor/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import adapter from '@sveltejs/adapter-auto'
import dotenv from 'dotenv'
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'

dotenv.config()

/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
Expand All @@ -9,6 +13,7 @@ const config = {
$src: 'src',
$stores: 'src/stores',
$dojo: 'src/dojo',
$manifests: `../contracts/manifests/${process.env.ENV}`
},
},
preprocess: vitePreprocess(),
Expand Down
4 changes: 4 additions & 0 deletions refactor/wrangler.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name = "octoguns-alpha"
compatibility_date = "2024-09-02"
pages_build_output_dir = ".svelte-kit/cloudflare"
send_metrics = false

0 comments on commit 1c4d0cf

Please sign in to comment.