From 97eb1bd7bc239461cf2f61696f0436df89a391cd Mon Sep 17 00:00:00 2001 From: Ramzi Hannachi <75175915+rhannachi@users.noreply.github.com> Date: Sat, 22 Jul 2023 13:12:03 +0200 Subject: [PATCH] Refactor - add build:rollup CI (#13) --- .github/workflows/workflow.yml | 79 +++++++++++++++++++++++++++++++--- CHANGELOG.md | 6 +++ package.json | 2 +- 3 files changed, 80 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index f95e8f2..5a7606e 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,7 +1,12 @@ name: GitHub Workflows (Lint, Test, Build) Actions # run workflow manually or during PR -on: [push, workflow_dispatch] +on: + push: + tags: + - '!**' + branches: + - '**' # Allow one concurrent deployment # concurrency: @@ -126,6 +131,9 @@ jobs: - name: Build Storybook run: pnpm build + - name: Build Rollup Storybook + run: pnpm build:rollup + - name: zip storybook-static run: tar -czf storybook-static.tar.gz ./storybook-static @@ -239,28 +247,87 @@ jobs: - name: Publish Summary run: echo -e "| Results | |\n| --- | --- |\n| Build Results | ${{steps.chromatic.outputs.buildUrl}} |\n| Storybook Preview | ${{steps.chromatic.outputs.storybookUrl}} |\n| Component Count | ${{steps.chromatic.outputs.componentCount}} |" >> $GITHUB_STEP_SUMMARY - ################################## Release ######################################### + ################################## Tag Main ######################################### + + tag_main: + needs: [ test ] + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + environment: + name: Production + steps: + - uses: actions/checkout@v3 + + - uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Step Node + uses: actions/setup-node@v3 + with: + node-version: '16.x' + cache: pnpm + +# - name: Load artifact node_modules +# uses: actions/download-artifact@v3 +# with: +# name: my_node_modules_artifact +# +# - name: unzip node_modules +# run: tar -xzf node_modules.tar.gz + + - name: 1 Tag main + run: | + version=$(pnpm pkg get version | tr -d '"') + echo new tag: $version +# git status +# echo create new tag: $version +# git tag -a v$version -m "version $version" +# echo push new tag +# git push --follow-tags origin main + + - name: 2 Tag main + run: | + echo new tag: $version + + - uses: rickstaa/action-create-tag@v1 + id: "tag_create" + with: + tag: $(pnpm pkg get version | tr -d '"') + tag_exists_error: false + message: version $(pnpm pkg get version | tr -d '"') + - run: | + echo "Tag already present: ${{ steps.tag_create.outputs.tag_exists }}" release: - needs: [ deployment ] + needs: [ tag_main ] runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' environment: name: Production steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Prepare repository run: git fetch --unshallow --tags + - uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Step Node uses: actions/setup-node@v3 with: node-version: '16.x' cache: pnpm - - name: Install dependencies - uses: bahmutov/npm-install@v1 + - name: Load artifact node_modules + uses: actions/download-artifact@v3 + with: + name: my_node_modules_artifact + + - name: unzip node_modules + run: tar -xzf node_modules.tar.gz - name: Create Release env: diff --git a/CHANGELOG.md b/CHANGELOG.md index cd3641b..44536ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.1.3 (Sat Jul 22 2023) + +- Update CI to automatically integrate releases. + +#### Authors: 1 + # v1.1.2 (Sat Jul 22 2023) - Update CI to automatically integrate releases. diff --git a/package.json b/package.json index fd15a7f..2433b7f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@rhannachi/components", "author": "rhannachi", - "version": "1.1.2", + "version": "1.1.3", "license": "MIT", "main": "dist/index.js", "module": "dist/index.esm.js",