updated build script

This commit is contained in:
Kasra Bigdeli
2020-06-30 21:30:05 -04:00
parent 0c9bf8d625
commit 4a29c75d68
4 changed files with 27 additions and 12 deletions

13
.github/workflows/publish_release.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
name: Build and push the release image
on:
push:
branches:
- release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
run: sudo ./dev-scripts/build_and_push_release.sh

2
.gitignore vendored
View File

@@ -6,6 +6,8 @@
/built
/dist-frontend
version
# JetBrains
.idea

View File

@@ -32,7 +32,7 @@ git clean -fdx .
npm ci
npm run build
node ./dev-scripts/validateBuildVersion.js
node ./dev-scripts/validate-build-version-docker-hub.js
# Get version from constant file
# Get version from tag (CAPROVER_VERSION_FROM_TAG) env var
# Make sure the two are the same

View File

@@ -8,6 +8,7 @@
// # Run API request to DockerHub and make sure it's a new version
const requestOriginal = require('request')
const fs = require('fs-extra')
function request(url) {
return new Promise(function (resolve, reject) {
@@ -32,20 +33,18 @@ let version = ''
Promise.resolve()
.then(function () {
version = require('./built/utils/CaptainConstants').configs.version
publishedNameOnDockerHub = require('./built/utils/CaptainConstants').configs.publishedNameOnDockerHub;
version = require('../built/utils/CaptainConstants').default.configs
.version
publishedNameOnDockerHub = require('../built/utils/CaptainConstants')
.default.configs.publishedNameOnDockerHub
if (!version || !publishedNameOnDockerHub) {
throw new Error('Version and publishedNameOnDockerHub must be present')
throw new Error(
'Version and publishedNameOnDockerHub must be present'
)
}
if (version !== process.env.CAPROVER_VERSION_FROM_TAG) {
throw new Error(`Version and CAPROVER_VERSION_FROM_TAG must be the same: ${version} ${process.env.CAPROVER_VERSION_FROM_TAG}`)
}
var URL =
`https://hub.docker.com/v2/repositories/${publishedNameOnDockerHub}/tags`
var URL = `https://hub.docker.com/v2/repositories/${publishedNameOnDockerHub}/tags`
return request(URL)
})
@@ -92,6 +91,7 @@ Promise.resolve()
)
}
fs.outputFileSync(`./version`, version)
})
.catch(function (err) {
console.error(err)