Skip to content

Commit

Permalink
Refactor - add build:rollup CI (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhannachi committed Jul 22, 2023
1 parent 2208f5a commit 273b764
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 7 deletions.
76 changes: 70 additions & 6 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -201,6 +209,7 @@ jobs:

deployment:
needs: [test]
name: "Deploy on Chromatic"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
Expand Down Expand Up @@ -239,28 +248,83 @@ 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 #########################################

extract-version:
needs: [ test ]
name: "Extract version (package.json)"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: Production
outputs:
version: ${{ steps.get-version.outputs.version }}
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: Get version
id: get-version
run: echo "version=$(pnpm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT
shell: bash

create-tag:
needs: [ extract-version ]
name: "Create Tag"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: Production
steps:
- uses: actions/checkout@v3

- uses: rickstaa/action-create-tag@v1
id: create-tag
with:
tag: ${{ needs.check-commit.outputs.version }}
tag_exists_error: false
message: ${{ needs.extract-version.outputs.version }}
- run: |
echo "Tag already present: ${{ steps.create-tag.outputs.tag_exists }}"
release:
needs: [ deployment ]
needs: [ create-tag ]
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:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 273b764

Please sign in to comment.