Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Build releases #35

Merged
merged 1 commit into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/release-core-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release Core-UI

on:
workflow_call:
inputs:
target_branch:
required: true
type: string
release_core_ui:
required: true
type: string

permissions:
actions: write
contents: write

jobs:
initialize:
name: Initialize
runs-on: ubuntu-20.04
outputs:
release_core_ui: ${{ env.release_core_ui }}
target_branch: ${{ env.target_branch }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.target_branch || github.ref_name }}
token: ${{ secrets.KIALI_PROJECT_TOKEN || github.token }}
- name: Configure git
run: |
git config user.email 'kialiProject@gmail.com'
git config user.name 'kialiProject'
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "14"
cache: yarn
cache-dependency-path: packages/core-ui/yarn.lock
- name: Get Types package version
working-directory: ./packages/types
run: echo "TYPES_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
- name: Update package core-ui with new types version
working-directory: ./packages/core-ui
run: yarn upgrade @kiali/types@$TYPES_VERSION
- name: Install dependencies and build 🔧
working-directory: ./packages/core-ui
run: yarn install && yarn build
- name: Major release
if: "${{ github.event.inputs.release_core_ui == 'major' }}"
working-directory: ./packages/core-ui
run: yarn version --major --no-git-tag-version
- name: Minor release
if: "${{ github.event.inputs.release_core_ui == 'minor' }}"
working-directory: ./packages/core-ui
run: yarn version --minor --no-git-tag-version
- name: Patch release
if: "${{ github.event.inputs.release_core_ui == 'patch' }}"
working-directory: ./packages/core-ui
run: yarn version --patch --no-git-tag-version
- name: Get version
working-directory: ./packages/core-ui
run : |
echo "NEW_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
- name: Publish package 📦
working-directory: ./packages/core-ui
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm publish --no-verify-access
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push changes to repository
working-directory: ./packages/core-ui
run: |
git add "package.json"
git commit -m "chore: release ${{ env.NEW_VERSION }}"
git tag ${{ env.NEW_VERSION }}
git push origin && git push --tags
72 changes: 72 additions & 0 deletions .github/workflows/release-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Release Types

on:
workflow_call:
inputs:
target_branch:
required: true
type: string
release_types:
required: true
type: string

permissions:
actions: write
contents: write

jobs:
initialize:
name: Initialize
runs-on: ubuntu-20.04
outputs:
release_types: ${{ env.release_types }}
target_branch: ${{ env.target_branch }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.target_branch || github.ref_name }}
token: ${{ secrets.KIALI_PROJECT_TOKEN || github.token }}
- name: Configure git
run: |
git config user.email 'kialiProject@gmail.com'
git config user.name 'kialiProject'
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "14"
cache: yarn
cache-dependency-path: packages/types/yarn.lock
- name: Install dependencies and build 🔧
working-directory: ./packages/types
run: yarn install && yarn build
- name: Major release
if: "${{ github.event.inputs.release_types == 'major' }}"
working-directory: ./packages/types
run: yarn version --major --no-git-tag-version
- name: Minor release
if: "${{ github.event.inputs.release_types == 'minor' }}"
working-directory: ./packages/types
run: yarn version --minor --no-git-tag-version
- name: Patch release
if: "${{ github.event.inputs.release_types == 'patch' }}"
working-directory: ./packages/types
run: yarn version --patch --no-git-tag-version
- name: Get version
working-directory: ./packages/types
run : |
echo "NEW_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
- name: Publish package 📦
working-directory: ./packages/types
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm publish --no-verify-access
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push changes to repository
working-directory: ./packages/types
run: |
git add "package.json"
git commit -m "chore: release Types package to version ${{ env.NEW_VERSION }}"
git tag ${{ env.NEW_VERSION }}
git push origin && git push --tags
113 changes: 50 additions & 63 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
name: Release

on:
push:
branches:
- main
workflow_dispatch:
inputs:
release_type:
description: Release type
release_core_ui:
description: Release Core-UI
required: true
default: "minor"
type: choice
options:
- major
- minor
- patch
release_branch:
release_types:
description: Release type
required: true
default: "minor"
type: choice
options:
- major
- minor
- patch
target_branch:
description: Branch to release
required: true
default: main
Expand All @@ -24,71 +36,46 @@ permissions:

jobs:
initialize:
name: Initialize
runs-on: ubuntu-20.04
outputs:
release_type: ${{ env.release_type }}
release_branch: ${{ env.release_version }}
release_types: ${{ env.release_types }}
release_core_ui: ${{ env.release_core_ui }}
target_branch: ${{ env.target_branch }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.release_branch || github.ref_name }}
ref: ${{ github.event.inputs.target_branch || github.ref_name }}
token: ${{ secrets.KIALI_PROJECT_TOKEN || github.token }}
- name: Configure git
run: |
git config user.email 'kialiProject@gmail.com'
git config user.name 'kialiProject'
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "14"
cache: yarn
cache-dependency-path: yarn.lock
- name: Install dependencies and build 🔧
run: yarn install && yarn build
- name: Major release
if: "${{ github.event.inputs.release_type == 'major' }}"
run: yarn version --major --no-git-tag-version
- name: Minor release
if: "${{ github.event.inputs.release_type == 'minor' }}"
run: yarn version --minor --no-git-tag-version
- name: Patch release
if: "${{ github.event.inputs.release_type == 'patch' }}"
run: yarn version --patch --no-git-tag-version
- name: Get version
run : |
echo "NEW_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
- name: Update changelog
uses: superfaceai/release-changelog-action@v1
with:
path-to-changelog: CHANGELOG.md
version: ${{ env.NEW_VERSION }}
operation: release
- name: Publish package 📦
- name: check modified files
id: check_files
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm publish --no-verify-access
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push changes to repository
run: |
git add "package.json"
git add "CHANGELOG.md"
git commit -m "chore: release ${{ env.NEW_VERSION }}"
git tag ${{ env.NEW_VERSION }}
git push origin && git push --tags
# Read version changelog
- id: get-changelog
name: Get version changelog
uses: superfaceai/release-changelog-action@v1
with:
path-to-changelog: CHANGELOG.md
version: ${{ env.NEW_VERSION }}
operation: read
# Update GitHub release with changelog
- name: Update GitHub release documentation
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.NEW_VERSION }}
body: ${{ steps.get-changelog.outputs.changelog }}
echo "=============== list modified files ==============="
git diff --name-only HEAD^ HEAD

echo "========== check paths of modified files =========="
git diff --name-only HEAD^ HEAD > files.txt
while IFS= read -r file
do
echo $file
if [[ $file != packages/types/* ]]; then
echo "This modified file is not under the 'types' folder."
echo "::set-output name=run_job::false"
break
else
echo "::set-output name=run_job::true"
fi
done < files.txt
publish_types:
needs: [initialize]
if: needs.check.outputs.run_job == 'true'
uses: ./.github/workflows/release-types.yml
with:
target_branch: ${{ github.event.inputs.target_branch || github.ref_name }}
release_types: ${{ github.event.inputs.release_types || github.ref_name }}
publish_core_ui:
needs: [initialize, publish_types]
uses: ./.github/workflows/release-core-ui.yml
with:
target_branch: ${{ github.event.inputs.target_branch || github.ref_name }}
release_core_ui: ${{ github.event.inputs.release_core_ui || github.ref_name }}
23 changes: 0 additions & 23 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion packages/core-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"license": "Apache-2.0",
"author": "Red Hat",
"dependencies": {
"@kiali/types": "0.13.0",
"@kiali/types": "0.0.1",
"@patternfly/patternfly": "4.179.1",
"@patternfly/react-charts": "6.51.5",
"@patternfly/react-core": "4.198.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiali/types",
"version": "0.13.0",
"version": "0.0.1",
"description": "Kiali Types",
"main": "lib/index.js",
"module": "lib/index.esm.js",
Expand Down