Commit 556d986a authored by Thebarda's avatar Thebarda
Browse files

Refactors npm publish for ui-context and ui

parent 25bbbdfe
......@@ -4,6 +4,9 @@ on:
pull_request:
types:
- closed
- opened
- edited
- ready_for_review
paths:
- ".github/workflows/js-config.yml"
- "centreon/packages/js-config/**"
......
name: ui-context-automerge
on:
pull_request:
types:
- labeled
- unlabeled
- synchronize
- opened
- edited
- ready_for_review
- reopened
- unlocked
paths:
- ".github/workflows/ui-automerge.yml"
- "centreon/packages/ui/**"
check_suite:
types:
- completed
jobs:
automerge:
runs-on: ubuntu-latest
if: ${{ startsWith(github.head_ref, 'MON-update-package-versions') }}
steps:
- id: automerge
name: automerge
uses: "pascalgn/automerge-action@v0.15.5"
env:
GITHUB_TOKEN: "${{ secrets.CENTREON_TECHNIQUE_PAT }}"
\ No newline at end of file
name: ui-context-automerge
on:
pull_request:
types:
- labeled
- unlabeled
- synchronize
- opened
- edited
- ready_for_review
- reopened
- unlocked
paths:
- ".github/workflows/ui-context-automerge.yml"
- "centreon/packages/ui-context/**"
check_suite:
types:
- completed
jobs:
automerge:
runs-on: ubuntu-latest
if: ${{ startsWith(github.head_ref, 'MON-update-package-versions') }}
steps:
- id: automerge
name: automerge
uses: "pascalgn/automerge-action@v0.15.5"
env:
GITHUB_TOKEN: "${{ secrets.CENTREON_TECHNIQUE_PAT }}"
\ No newline at end of file
name: centreon-ui-context
on:
workflow_dispatch:
pull_request:
types:
- closed
- opened
- edited
- ready_for_review
paths:
- ".github/workflows/ui.yml"
- ".github/workflows/ui-context.yml"
- "centreon/packages/ui-context/**"
push:
branches:
- develop
paths:
- ".github/workflows/ui.yml"
- "centreon/packages/ui-context/**"
tags-ignore:
- ui-context-*
env:
version: "23.04"
directory: "centreon/packages/ui-context"
centreon_directory: "centreon"
package: 'ui-context'
base_branch: develop
jobs:
lint:
......@@ -48,46 +47,16 @@ jobs:
deliver-npm:
runs-on: ubuntu-22.04
needs: [lint]
if: github.ref == 'refs/heads/develop'
if: ${{ github.event.pull_request.merged == true && !startsWith(github.head_ref, 'MON-update-package-versions') }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 17
- name: Update JS config version
run: |
git config user.email "technique-ci@centreon.com"
git config user.name "technique-ci"
git config pull.rebase false
npm version patch -m "ui-context-%s" --legacy-peer-deps
VERSION=ui-context-$(node -p "require('./package.json').version")
git pull
git add .
git commit -m "chore: release ${VERSION}"
git tag ${VERSION}
working-directory: ${{ env.directory }}
- name: Push changes
run: |
git config user.email "technique-ci@centreon.com"
git config user.name "technique-ci"
git push https://${{ secrets.CENTREON_TECHNIQUE_PAT }}@github.com/centreon/centreon ${{ github.head_ref || github.ref_name }}
shell: bash
- name: Push changes with tags
run: |
git config user.email "technique-ci@centreon.com"
git config user.name "technique-ci"
git push https://${{ secrets.CENTREON_TECHNIQUE_PAT }}@github.com/centreon/centreon ${{ github.head_ref || github.ref_name }} --tags
shell: bash
ref: ${{ env.base_branch }}
- uses: JS-DevTools/npm-publish@v1
- uses: ./.github/actions/npm-publish
with:
token: ${{ secrets.NPM_TOKEN }}
package: ${{ env.directory }}/package.json
tag: ${{ github.head_ref || github.ref_name }}
access: public
\ No newline at end of file
directory: ${{ env.directory }}
pat: ${{ secrets.CENTREON_TECHNIQUE_PAT }}
npm_token: ${{ secrets.NPM_TOKEN }}
package: ${{ env.package }}
\ No newline at end of file
name: centreon-ui
on:
workflow_dispatch:
pull_request:
types:
- closed
- opened
- edited
- ready_for_review
paths:
- ".github/workflows/ui.yml"
- "centreon/packages/ui/**"
push:
branches:
- develop
paths:
- ".github/workflows/ui.yml"
- "centreon/packages/ui/**"
tags-ignore:
- ui-*
env:
version: "23.04"
directory: "centreon/packages/ui"
centreon_directory: "centreon"
package: 'ui'
base_branch: develop
jobs:
lint:
......@@ -84,46 +83,16 @@ jobs:
deliver-npm:
runs-on: ubuntu-22.04
needs: [lint, unit-test]
if: github.ref == 'refs/heads/develop'
if: ${{ github.event.pull_request.merged == true && !startsWith(github.head_ref, 'MON-update-package-versions') }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 17
- name: Update JS config version
run: |
git config user.email "technique-ci@centreon.com"
git config user.name "technique-ci"
git config pull.rebase false
npm version patch -m "ui-%s" --legacy-peer-deps
VERSION=ui-$(node -p "require('./package.json').version")
git pull
git add .
git commit -m "chore: release ${VERSION}"
git tag ${VERSION}
working-directory: ${{ env.directory }}
ref: ${{ env.base_branch }}
- name: Push changes
run: |
git config user.email "technique-ci@centreon.com"
git config user.name "technique-ci"
git push https://${{ secrets.CENTREON_TECHNIQUE_PAT }}@github.com/centreon/centreon ${{ github.head_ref || github.ref_name }}
shell: bash
- name: Push changes with tags
run: |
git config user.email "technique-ci@centreon.com"
git config user.name "technique-ci"
git push https://${{ secrets.CENTREON_TECHNIQUE_PAT }}@github.com/centreon/centreon ${{ github.head_ref || github.ref_name }} --tags
shell: bash
- uses: JS-DevTools/npm-publish@v1
- uses: ./.github/actions/npm-publish
with:
token: ${{ secrets.NPM_TOKEN }}
package: ${{ env.directory }}/package.json
tag: ${{ github.head_ref || github.ref_name }}
access: public
directory: ${{ env.directory }}
pat: ${{ secrets.CENTREON_TECHNIQUE_PAT }}
npm_token: ${{ secrets.NPM_TOKEN }}
package: ${{ env.package }}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment