ci: generate custom version name for dev + `main` tags

This commit is contained in:
Joxit 2023-05-24 23:38:06 +02:00
parent 8e98c1c63b
commit e7e762d6d9
No known key found for this signature in database
GPG Key ID: F526592B8E012263
5 changed files with 20 additions and 1 deletions

View File

@ -15,6 +15,8 @@ jobs:
run: npm test
- name: Build the interface
run: npm run build
env:
DEVELOPMENT_BUILD: ${{ github.sha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx

View File

@ -16,3 +16,5 @@ jobs:
run: npm test
- name: Build the interface
run: npm run build
env:
DEVELOPMENT_BUILD: ${{ github.event.pull_request.head.sha }}

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ _site
*.orig
.serve/
demo/v2
.version.json

View File

@ -14,10 +14,24 @@ import copyTransform from './rollup/copy-transform.js';
import license from './rollup/license.js';
import checkOutput from './rollup/check-output.js';
import importSVG from './rollup/import-svg.js';
import fs from 'fs';
const version = JSON.parse(fs.readFileSync('./package.json', 'utf-8')).version;
const useServe = process.env.ROLLUP_SERVE === 'true';
const output = useServe ? '.serve' : 'dist';
const getVersion = (version) => {
const parts = version.split('.').map((e) => parseInt(e));
if (useServe || process.env.DEVELOPMENT_BUILD) {
parts[1]++;
parts[2] = 0;
return parts.join('.') + (useServe ? '-dev' : `-${process.env.DEVELOPMENT_BUILD.slice(0, 10)}`);
}
return version;
};
fs.writeFileSync('.version.json', JSON.stringify({ version: getVersion(version) }));
const plugins = [
riot(),
json(),

View File

@ -128,7 +128,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</material-footer>
</footer>
<script>
import { version } from '../../package.json';
import { version } from '../../.version.json';
import { Router, Route } from '@riotjs/route';
import Catalog from './catalog/catalog.riot';
import TagList from './tag-list/tag-list.riot';