Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize GitHub workflow for release build #322

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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
REPO_OWNER=bitfinexcom
REPO_BRANCH=master
IS_BFX_API_STAGING=0
IS_DEV_ENV=0
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/build-electron-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set repo owner
run: |
sed -i -e \
"s/owner: '.*'/owner: '${{ github.repository_owner }}'/g" \
"./electron-builder-config.js"
- if: github.event.inputs.version != ''
name: Set release version
run: |
Expand Down Expand Up @@ -73,6 +68,7 @@ jobs:
continue-on-error: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_OWNER: ${{ github.repository_owner }}
with:
timeout_minutes: 20
retry_wait_seconds: 10
Expand Down Expand Up @@ -110,11 +106,6 @@ jobs:
run: |
brew install gnu-sed
echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
- name: Set repo owner
run: |
sed -i -e \
"s/owner: '.*'/owner: '${{ github.repository_owner }}'/g" \
"./electron-builder-config.js"
- if: github.event.inputs.version != ''
name: Set release version
run: |
Expand Down Expand Up @@ -158,6 +149,7 @@ jobs:
CSC_LINK: ${{ secrets.BFX_APPLE_BUILD_CERTIFICATE_B64 }}
CSC_KEY_PASSWORD: ${{ secrets.BFX_APPLE_BUILD_CERTIFICATE_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_OWNER: ${{ github.repository_owner }}
ELECTRON_CACHE: ${{ runner.temp }}/.cache/electron
with:
timeout_minutes: 40
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/e2e-test-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
e2e-web-page-report:
name: E2E Web Page Report
runs-on: ubuntu-22.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: dorny/test-reporter@v1
id: linux-e2e-test-results
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
web-page-report:
name: Web Page Report
runs-on: ubuntu-22.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: dorny/test-reporter@v1
id: test-results
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.linux-builder
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN ./scripts/helpers/install-nodejs.sh ${NODE_VERSION} \
bc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN chown root:root .

COPY . .

Expand Down
1 change: 1 addition & 0 deletions Dockerfile.mac-builder
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN ./scripts/helpers/install-nodejs.sh ${NODE_VERSION} \
bc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN chown root:root .

COPY . .

Expand Down
1 change: 1 addition & 0 deletions Dockerfile.ui-builder
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ENV IS_DEV_ENV=${IS_DEV_ENV:-0}
COPY ./scripts/helpers/install-nodejs.sh ./scripts/helpers/install-nodejs.sh

RUN ./scripts/helpers/install-nodejs.sh ${NODE_VERSION}
RUN chown root:root .

COPY . .

Expand Down
1 change: 1 addition & 0 deletions Dockerfile.win-builder
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ RUN ./scripts/helpers/install-nodejs.sh ${NODE_VERSION} \
bc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN chown root:root .

COPY . .

Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ services:
IS_PUBLISHED: ${IS_PUBLISHED:-0}
GH_TOKEN: ${GH_TOKEN:-}
GITHUB_TOKEN: ${GITHUB_TOKEN:-}
REPO_OWNER: ${REPO_OWNER:-}
EP_GH_IGNORE_TIME: ${EP_GH_IGNORE_TIME:-true}
CURRENT_UID: ${CURRENT_UID:-"1000:1000"}
volumes:
Expand All @@ -52,6 +53,7 @@ services:
IS_PUBLISHED: ${IS_PUBLISHED:-0}
GH_TOKEN: ${GH_TOKEN:-}
GITHUB_TOKEN: ${GITHUB_TOKEN:-}
REPO_OWNER: ${REPO_OWNER:-}
EP_GH_IGNORE_TIME: ${EP_GH_IGNORE_TIME:-true}
CURRENT_UID: ${CURRENT_UID:-"1000:1000"}
volumes:
Expand All @@ -76,6 +78,7 @@ services:
IS_PUBLISHED: ${IS_PUBLISHED:-0}
GH_TOKEN: ${GH_TOKEN:-}
GITHUB_TOKEN: ${GITHUB_TOKEN:-}
REPO_OWNER: ${REPO_OWNER:-}
EP_GH_IGNORE_TIME: ${EP_GH_IGNORE_TIME:-true}
CURRENT_UID: ${CURRENT_UID:-"1000:1000"}
volumes:
Expand Down
55 changes: 54 additions & 1 deletion electron-builder-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,59 @@ const parseEnvValToBool = require(
'./src/helpers/parse-env-val-to-bool'
)

const electronEnvVars = {
REPO_OWNER: 'bitfinexcom'
}
let electronEnvVarsFromFile = {}

const electronEnvFilePath = path.join(
__dirname, 'electronEnv.json'
)
const electronEnvExampleFilePath = path.join(
__dirname, 'electronEnv.json.example'
)

let hasElectronEnv = false
let hasNewElectronEnv = false

try {
electronEnvVarsFromFile = require(electronEnvFilePath)
Object.assign(electronEnvVars, electronEnvVarsFromFile)
hasElectronEnv = true
} catch (err) {}

if (!hasElectronEnv) {
try {
electronEnvVarsFromFile = JSON.parse(
fs.readFileSync(electronEnvExampleFilePath, 'utf8')
)
Object.assign(electronEnvVars, electronEnvVarsFromFile)
fs.writeFileSync(
electronEnvFilePath,
JSON.stringify(electronEnvVars, null, 2),
'utf8'
)
hasElectronEnv = true
} catch (err) {}
}

if (process.env.REPO_OWNER) {
electronEnvVars.REPO_OWNER = process.env.REPO_OWNER
}
if (electronEnvVars.REPO_OWNER !== electronEnvVarsFromFile.REPO_OWNER) {
hasNewElectronEnv = true
}

if (hasNewElectronEnv) {
try {
fs.writeFileSync(
electronEnvFilePath,
JSON.stringify(electronEnvVars, null, 2),
'utf8'
)
} catch (err) {}
}

let version
let zippedAppImageArtifactPath
let zippedMacArtifactPath
Expand Down Expand Up @@ -88,7 +141,7 @@ module.exports = {
publish: {
provider: 'github',
repo: 'bfx-report-electron',
owner: 'bitfinexcom',
owner: electronEnvVars.REPO_OWNER,
vPrefixedTagName: true,
channel: 'latest',

Expand Down
3 changes: 2 additions & 1 deletion electronEnv.json.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"NODE_ENV": "production",
"IS_AUTO_UPDATE_DISABLED": false
"IS_AUTO_UPDATE_DISABLED": false,
"REPO_OWNER": "bitfinexcom"
}