Skip to content

Commit

Permalink
chore: gh workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
giniedp committed Aug 5, 2023
1 parent 53c8f42 commit 24317b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.js.yml
Expand Up @@ -6,6 +6,9 @@ on:
push:
branches:
- "main"
env:
NW_CDN_LIVE: ${{ vars.NW_CDN_LIVE }}
NW_CDN_PTR: ${{ vars.NW_CDN_PTR }}

jobs:
prepare:
Expand Down
11 changes: 3 additions & 8 deletions env.js
Expand Up @@ -10,14 +10,9 @@ function cmd(cmd) {
}

// https://developers.cloudflare.com/pages/platform/build-configuration/#environment-variables
const CF = {
pages: process.env.CF_PAGES,
commitHash: process.env.CF_PAGES_COMMIT_SHA,
branchName: process.env.CF_PAGES_BRANCH,
pagessUrl: process.env.CF_PAGES_URL,
}

const branchName = CF.branchName || cmd('git branch --show-current')
const branchName = process.env.CF_PAGES_BRANCH || process.env.GITHUB_REF_NAME || cmd('git branch --show-current')
const commitHash = process.env.CF_PAGES_COMMIT_SHA || process.env.GITHUB_SHA
const path = require('path')
const config = {
NW_GAME_LIVE: process.env.NW_GAME_LIVE,
Expand All @@ -33,7 +28,7 @@ const config = {
CDN_UPLOAD_KEY: process.env.CDN_UPLOAD_KEY,
CDN_UPLOAD_SECRET: process.env.CDN_UPLOAD_SECRET,
CDN_UPLOAD_ENDPOINT: process.env.CDN_UPLOAD_ENDPOINT,
VERSION: require(path.resolve(process.cwd(), 'package.json')).version + (CF.pages ? `#${CF.commitHash}` : ''),
VERSION: require(path.resolve(process.cwd(), 'package.json')).version + (commitHash ? `#${commitHash}` : ''),
}

function get(name) {
Expand Down

0 comments on commit 24317b3

Please sign in to comment.