Skip to content

Commit

Permalink
Merge branch 'master' into feature/AG-26383
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed Nov 7, 2023
2 parents 6f0d41d + 0353fe0 commit 4ac623b
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
.eslintcache
coverage
node_modules
out
out
3 changes: 3 additions & 0 deletions bamboo-specs/bamboo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

---
!include 'increment.yaml'

---
!include 'build.yaml'
68 changes: 68 additions & 0 deletions bamboo-specs/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
version: 2
plan:
project-key: AJL
key: VSCODEADBLOCKSYNTAXBUILD
name: vscode adblock syntax - build release
variables:
dockerNode: adguard/node-ssh:18.13--0

stages:
- Build:
manual: false
final: false
jobs:
- Build

Build:
key: BUILD
other:
clean-working-dir: true
docker:
image: ${bamboo.dockerNode}
volumes:
${system.YARN_DIR}: "${bamboo.cacheYarn}"
tasks:
- checkout:
force-clean-build: true
- script:
interpreter: SHELL
scripts:
- |-
set -x
set -e
ls -al
yarn install ${bamboo.varsYarn}
yarn build-txt
rm -rf node_modules
- inject-variables:
file: dist/build.txt
scope: RESULT
namespace: inject
- any-task:
plugin-key: com.atlassian.bamboo.plugins.vcs:task.vcs.tagging
configuration:
selectedRepository: defaultRepository
tagName: v${bamboo.inject.version}
requirements:
- adg-docker: true

triggers: []

branches:
create: manually
delete: never
link-to-jira: true

notifications:
- events:
- plan-status-changed
recipients:
- webhook:
name: Build webhook
url: http://prod.jirahub.service.eu.consul/v1/webhook/bamboo
labels: []
other:
concurrent-build-plugin: system-default
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"lint:md": "markdownlint .",
"lint:ts": "eslint . --cache --ext .ts",
"test": "jest",
"build-txt": "ts-node-esm tools/build-txt.ts",
"increment": "yarn version --patch --no-git-tag-version",
"generate-vsix": "vsce package --yarn --out vscode-adblock.vsix",
"postinstall": "cd client && yarn && cd ../server && yarn && cd ..",
Expand Down
40 changes: 40 additions & 0 deletions tools/build-txt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @file Output the version number to a build.txt file
*/
import fs from 'fs';
import path from 'path';

const UPPER_LEVEL = '../';

const OUTPUT_FOLDER_NAME = 'out';
const OUTPUT_FILE_NAME = 'build.txt';
const PKG_FILE_NAME = 'package.json';

// Computed constants
const outputFolderLocation = path.join(__dirname, UPPER_LEVEL, OUTPUT_FOLDER_NAME);
const pkgFileLocation = path.join(__dirname, UPPER_LEVEL, PKG_FILE_NAME);

// Read package.json
const pkg = JSON.parse(fs.readFileSync(pkgFileLocation, 'utf-8'));

if (!pkg.version) {
throw new Error('Missing required field "version" in package.json');
}

const main = (): void => {
const content = `version=${pkg.version}`;

// Create the output folder if it doesn't exist
if (!fs.existsSync(outputFolderLocation)) {
fs.mkdirSync(outputFolderLocation);
}

// Write the output file
const file = path.resolve(outputFolderLocation, OUTPUT_FILE_NAME);
fs.writeFileSync(file, content);

// eslint-disable-next-line no-console
console.log(`Wrote ${content} to ${file} was successful`);
};

main();

0 comments on commit 4ac623b

Please sign in to comment.