forked from decentraland/game-expo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from decentraland/feat/add-build-system
feat: Add Build system
- Loading branch information
Showing
14 changed files
with
269 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GATSBY_WEBSITE_VERSION="1.0.0" | ||
ASSET_PREFIX="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GATSBY_WEBSITE_VERSION="1.0.0" | ||
ASSET_PREFIX="https://cdn.decentraland.org/@dcl/art-week-site/1.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Audit | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
audit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Use Node.js 16.x | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 16.x | ||
cache: "npm" | ||
- name: Install | ||
run: npm i | ||
- name: Audit signatures | ||
run: npm audit signatures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Build and release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
build-release: | ||
permissions: | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Use Node.js 16.x | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 16.x | ||
cache: "npm" | ||
- name: Set package.json version | ||
uses: menduz/oddish-action@master | ||
with: | ||
cwd: ./webapp | ||
deterministic-snapshot: true | ||
only-update-versions: true | ||
- name: Install | ||
run: npm install | ||
- name: Build | ||
env: | ||
NODE_ENV: production | ||
run: npm run build -- --prefix-paths | ||
- name: Publish | ||
uses: menduz/oddish-action@master | ||
with: | ||
cwd: ./public | ||
deterministic-snapshot: true | ||
registry-url: "https://registry.npmjs.org" | ||
access: public | ||
gitlab-token: ${{ secrets.GITLAB_CDN_DEPLOYER_TOKEN }} | ||
gitlab-pipeline-url: ${{ secrets.GITLAB_CDN_DEPLOYER_URL }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Set rollout by path - Manual | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
packageVersion: | ||
description: "NPM Version of the release (@dcl/art-week-site)" | ||
required: true | ||
default: "" | ||
deploymentEnvironment: | ||
type: "choice" | ||
description: "Deployment environment" | ||
required: true | ||
default: "zone" | ||
options: | ||
- zone | ||
- today | ||
- org | ||
rolloutPercentage: | ||
description: "The percentage for this rollout" | ||
required: true | ||
default: "100" | ||
|
||
jobs: | ||
set-manual-by-path-rollout: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: hmarr/debug-action@v2 | ||
- name: Set Rollout | ||
uses: decentraland/set-rollout-action@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Repo deployment info | ||
ref: ${{ github.event.ref }} | ||
sha: ${{ github.sha }} | ||
|
||
# CDN information | ||
packageName: "@dcl/art-week-site" | ||
packageVersion: ${{ github.event.inputs.packageVersion }} | ||
|
||
# Rollout information | ||
deploymentPath: "artweek" | ||
deploymentEnvironment: ${{ github.event.inputs.deploymentEnvironment }} | ||
deploymentName: "_site" | ||
percentage: ${{ github.event.inputs.rolloutPercentage }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Set rollout by path | ||
|
||
on: [deployment_status] | ||
|
||
jobs: | ||
set-rollout: | ||
if: ${{ github.event.deployment.task == 'upload-to-cdn' && github.event.deployment_status.state == 'success' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: hmarr/debug-action@v2 | ||
|
||
# Dev | ||
- name: Set Rollout - Development | ||
uses: decentraland/set-rollout-action@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Repo deployment info | ||
ref: ${{ github.event.deployment.ref }} | ||
sha: ${{ github.event.deployment.sha }} | ||
|
||
# CDN information | ||
packageName: ${{ github.event.deployment.payload.packageName }} | ||
packageVersion: ${{ github.event.deployment.payload.packageVersion }} | ||
|
||
# Rollout information | ||
deploymentPath: "artweek" | ||
deploymentEnvironment: "zone" | ||
deploymentName: "_site" | ||
percentage: 100 | ||
|
||
# Stg | ||
- name: Set Rollout - Staging | ||
uses: decentraland/set-rollout-action@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Repo deployment info | ||
ref: ${{ github.event.deployment.ref }} | ||
sha: ${{ github.event.deployment.sha }} | ||
|
||
# CDN information | ||
packageName: ${{ github.event.deployment.payload.packageName }} | ||
packageVersion: ${{ github.event.deployment.payload.packageVersion }} | ||
|
||
# Rollout information | ||
deploymentPath: "artweek" | ||
deploymentEnvironment: "today" | ||
deploymentName: "_site" | ||
percentage: 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ public | |
.cache | ||
.DS_Store | ||
yarn.lock | ||
package.lock | ||
package.lock | ||
.env.production | ||
package.json.tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
# DCLMF 2023 - Decentraland Music Festival | ||
|
||
![festival](./static/logo-metaverse.png) | ||
# DCL Art Week Site - Decentraland Art Week |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const fs = require("fs"); | ||
|
||
const PACKAGE_JSON_PUBLIC_PATH = "./public/package.json"; | ||
const PACKAGE_JSON_TEMP_PATH = "./package.json.tmp"; | ||
|
||
fs.copyFileSync(PACKAGE_JSON_TEMP_PATH, PACKAGE_JSON_PUBLIC_PATH); | ||
fs.unlinkSync(PACKAGE_JSON_TEMP_PATH); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* eslint-disable */ | ||
const fs = require("fs"); | ||
const dotenv = require("dotenv"); | ||
|
||
dotenv.config(); | ||
|
||
let ENV_CONTENT = {}; | ||
|
||
// read files | ||
if (fs.existsSync(".env")) { | ||
Object.assign(ENV_CONTENT, dotenv.parse(fs.readFileSync(".env"))); | ||
} | ||
const packageJson = JSON.parse(fs.readFileSync("./package.json").toString()); | ||
|
||
// set version | ||
ENV_CONTENT["GATSBY_WEBSITE_VERSION"] = packageJson.version; | ||
|
||
// set public url | ||
Object.assign(ENV_CONTENT, getPublicUrls()); | ||
packageJson.homepage = ENV_CONTENT["ASSET_PREFIX"]; | ||
if (packageJson.homepage) { | ||
// github action outputs. Do not touch. | ||
console.log("::set-output name=public_url::" + packageJson.homepage); | ||
console.log( | ||
"::set-output name=public_path::" + new URL(packageJson.homepage).pathname | ||
); | ||
} | ||
|
||
// log stuff | ||
console.log("VERSIONS: ", Object.entries(ENV_CONTENT), "\n"); | ||
|
||
// save files | ||
fs.writeFileSync( | ||
".env.production", | ||
Object.entries(ENV_CONTENT) | ||
.map((e) => e[0] + "=" + JSON.stringify(e[1])) | ||
.join("\n") + "\n" | ||
); | ||
fs.writeFileSync("./package.json.tmp", JSON.stringify(packageJson, null, 2)); | ||
|
||
// public url logic | ||
function getPublicUrls() { | ||
const isStatic = !!process.env.GEN_STATIC_LOCAL; | ||
const isCI = !!process.env.CI; | ||
const isCDN = !isStatic && isCI; | ||
console.log("is static", isStatic); | ||
console.log("is CI", isCI); | ||
console.log("is CDN", isCDN); | ||
if (isCDN) { | ||
// master/main branch, also releases | ||
const cdnUrl = `https://cdn.decentraland.org/${packageJson.name}/${packageJson.version}`; | ||
console.log(`Using CDN as public url: "${cdnUrl}"`); | ||
return { | ||
ASSET_PREFIX: cdnUrl, | ||
}; | ||
} | ||
// localhost | ||
console.log("Using empty pubic url"); | ||
return { | ||
ASSET_PREFIX: "", | ||
}; | ||
} |