Skip to content

Commit

Permalink
Test the Pre-Release[0]
Browse files Browse the repository at this point in the history
  • Loading branch information
cvetty committed Dec 12, 2024
1 parent b6ab7d2 commit 336ae40
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 70 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ env:
NODE_VERSION: "20.16.0"

concurrency:
group: release
group: release-${{ github.ref_name }}
cancel-in-progress: false

permissions:
contents: write

jobs:
check_branch:
name: Check the release branch
name: Check the Release Branch
runs-on: ubuntu-22.04
outputs:
major_version: ${{ steps.extract_major_version.outputs.version }}
Expand All @@ -48,14 +48,14 @@ jobs:
echo "version=$MAJOR_VERSION" >> "$GITHUB_OUTPUT"
echo "Extracted major version: $MAJOR_VERSION"
pre_release:
name: Create Pre-Release
set_version:
name: Set Package Version
runs-on: ubuntu-22.04
needs: [check_branch]
outputs:
release_id: ${{ steps.update-release.outputs.release_id }}
version: ${{ steps.pre_release_version.outputs.version }}
steps:
- name: Get Token
- name: Get the github token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v3
with:
Expand All @@ -65,8 +65,6 @@ jobs:
- name: Checkout the repo
uses: actions/checkout@v4
with:
ref: main
lfs: false
token: ${{ steps.get_workflow_token.outputs.token }}

- name: Install NodeJS
Expand All @@ -80,6 +78,7 @@ jobs:
git config user.name "github-actions[bot]"
- name: Ensure that the major version matches the branch
working-directory: krait-ui
env:
MAJOR_VERSION: ${{ needs.check_branch.outputs.major_version }}
run: |
Expand All @@ -92,80 +91,87 @@ jobs:
fi
- name: Update version in package.json
working-directory: krait-ui
if: github.event.inputs.version-update != 'no update'
run: npm version $VERSION_UPDATE --no-git-tag-version
working-directory: krait-ui
env:
VERSION_UPDATE: ${{ github.event.inputs.version-update }}
run: npm version $VERSION_UPDATE --no-git-tag-version

- name: Set the version as pre-release(beta)
id: create_tag
- name: Set the version as pre-release(beta version)
id: pre_release_version
working-directory: krait-ui
env:
GITHUB_TOKEN: ${{ steps.get_workflow_token.outputs.token }}
run: |
TAG=$(npm version prerelease --preid=beta)
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
VERSION=$(npm version prerelease --preid=beta)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
# - name: Commit the version update
# env:
# TAG_NAME: ${{ steps.create_tag.outputs.tag }}
# run: |
# git commit -am "[GHA] Update package version to $TAG_NAME"
# git push
- name: Commit the version update
env:
VERSION: ${{ steps.pre_release_version.outputs.version }}
run: |
git commit -am "[GHA] Update package version to $VERSION"
git push
- name: Set pre-release tag
id: update-release
uses: ./.github/actions/set-release-tag
build_ui:
name: Build UI Library
needs: [set_version]
runs-on: ubuntu-22.04
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
# branch_name: ${{ github.ref_name }}
branch_name: 1.x
tag_name: ${{ steps.create_tag.outputs.tag }}

# build_ui:
# name: Build UI Library
# needs: [pre_release]
# runs-on: ubuntu-20.04
# steps:
# - name: Get Token
# id: get_workflow_token
# uses: peter-murray/workflow-application-token-action@v3
# with:
# application_id: ${{ vars.GH_MTR_PACKAGE_VERSIONS_APP_ID }}
# application_private_key: ${{ secrets.GH_MTR_PACKAGE_VERSIONS_APP_SECRET }}
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
cache-dependency-path: "krait-ui/package-lock.json"

# - name: Checkout the repo
# uses: actions/checkout@v4
# with:
# ref: main
# lfs: false
# token: ${{ steps.get_workflow_token.outputs.token }}
- name: Install npm dependencies
working-directory: krait-ui
run: npm ci

# - name: Install NodeJS
# uses: actions/setup-node@v4
# with:
# node-version: ${{ env.NODE_VERSION }}
# registry-url: "https://registry.npmjs.org"
- name: Build FE assets
working-directory: krait-ui
run: npm run build

# - name: Retrieve the npm dependencies cache
# uses: actions/cache@v4
# id: node-modules-cache
# with:
# path: node_modules
# key: npm-dependencies-${{ runner.os }}-${{ hashFiles('krait-ui/package-lock.json') }}
# restore-keys: |
# npm-dependencies-${{ hashFiles('krait-ui/package-lock.json') }}
# npm-dependencies-
- name: Zip the distribution build
working-directory: krait-ui
run: zip -9qry "distribution-package.zip" "./" -i "dist/*" "package.json" "package-lock.json"

# - name: Install npm dependencies
# if: steps.node-modules-cache.outputs.cache-hit != 'true'
# run: cd krait-ui && npm ci
- uses: actions/upload-artifact@v4
with:
name: distribution-package.zip
path: krait-ui/distribution-package.zip

pre_release:
name: Create Pre-Release
runs-on: ubuntu-22.04
needs: [set_version]
outputs:
release_id: ${{ steps.update-release.outputs.release_id }}
steps:
- name: Checkout the repo
uses: actions/checkout@v4

# - name: Build FE assets
# run: cd krait-ui && npm run build
- name: Set pre-release tag
id: update-release
uses: ./.github/actions/set-release-tag
with:
branch_name: ${{ github.ref_name }}
tag_name: ${{ needs.set_version.outputs.version }}

# - name: Zip the distribution build
# run: cd krait-ui && zip -9qry "distribution-package.zip" "./" -i "dist/*" "package.json" "package-lock.json"
# publish_npm_package:
# name: Publish the UI NPM package
# runs-on: ubuntu-22.04
# needs: [pre_release, build_ui]
# steps:
# - name: Download the distribution build
# uses: actions/download-artifact@v4
# with:
# name: distribution-package.zip
# path: ./distribution-package.zip

# - name: Upload an Asset in GitHub Release
# uses: actions/github-script@v6
Expand All @@ -179,12 +185,13 @@ jobs:
# owner: context.repo.owner,
# repo: context.repo.repo,
# release_id: ${{ env.RELEASE_ID }},
# data: await fs.readFile('./krait-ui/distribution-package.zip')
# data: await fs.readFile('./distribution-package.zip')
# });
# env:
# RELEASE_ID: ${{ needs.prerelease.outputs.release_id }}
# RELEASE_ID: ${{ needs.pre_release.outputs.release_id }}

# - name: Publish the NPM package
# run: cd krait-ui && npm publish --access public --tag dev
# working-directory: krait-ui
# run: npm publish --access public --tag dev
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
- name: Install npm dependencies
run: npm ci

- name: Run Prettier Check
- name: Run Prettier check
run: npm run prettier

- name: Run Lint Check
- name: Run Lint check
run: npm run lint

- name: Build
Expand Down

0 comments on commit 336ae40

Please sign in to comment.