Skip to content

Commit

Permalink
ci: ajusta a publicacao da tag @beta
Browse files Browse the repository at this point in the history
Ajusta a publicação na tag @beta do NPM

Fixes DTHFUI-8276
  • Loading branch information
anderson-gregorio-totvs committed Mar 11, 2024
1 parent 1dd5ac9 commit 88042fb
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ name: CI
# Define em quais situações esse workflow será executado
on:
push:
branches: [ master, '[0-9]+.x.x' ]
branches: [ master, development, '[0-9]+.x.x' ]
pull_request:
branches: [ master, '[0-9]+.x.x' ]
branches: [ master, development, '[0-9]+.x.x' ]

# Os jobs são conjuntos de actions que são executados na mesma máquina virtual.
# É possível ter mais de um job e assim executar ações paralelamente.
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/publish_po_angular_ci-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@ env:

on:
workflow_dispatch:
inputs:
version-beta:
description: Informe a versão do Beta do PO-UI
required: true
version-po-style:
description: Informe a versão do @po-ui/style
required: true
default: 'latest'

jobs:
build-and-publish:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/development'
steps:
- uses: actions/setup-node@v3
with:
Expand All @@ -39,6 +48,10 @@ jobs:
repository: po-ui/po-tslint
path: po-tslint

- name: Update Version
run: node ./scripts/update-version.js ${{ github.event.inputs.version-beta }} ${{ github.event.inputs.version-po-style }}
working-directory: ${{env.WORKING_DIR}}

- name: Install and Build
run: npm install && npm run build
working-directory: ${{env.WORKING_DIR}}
Expand Down
20 changes: 20 additions & 0 deletions scripts/update-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const fs = require('fs');

const packageDistPath = `${__dirname}/../package.json`;
const packageContent = fs.readFileSync(packageDistPath);
const packageJson = JSON.parse(packageContent);

if (process.argv.length != 4){
console.error('Expected at least one argument!');
process.exit(1);
}

const versionBeta = process.argv[2];
const versionPoStyle= process.argv[3];

packageJson.version = versionBeta;
packageJson.dependencies['@po-ui/style'] = versionPoStyle;

fs.writeFileSync(packageDistPath, JSON.stringify(packageJson, null, 2));

console.log(JSON.stringify(packageJson, null, 2))

0 comments on commit 88042fb

Please sign in to comment.