From 82a6aef7089a7abc4493957ab75398620bb3abf5 Mon Sep 17 00:00:00 2001 From: draedful Date: Fri, 4 Oct 2024 22:50:13 +0300 Subject: [PATCH] Add ci actions to release and generate storybook on push to main --- .github/workflows/main-preview.yml | 31 ++++++++++++++++++++++++++++++ .github/workflows/release.yml | 20 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .github/workflows/main-preview.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/main-preview.yml b/.github/workflows/main-preview.yml new file mode 100644 index 0000000..6539499 --- /dev/null +++ b/.github/workflows/main-preview.yml @@ -0,0 +1,31 @@ +name: Main Preview + +on: + push: + branches: [main] + +jobs: + main: + name: Build and Deploy + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: npm + - name: Install Packages + run: npm ci + shell: bash + - name: Build Storybook + run: npm run build-storybook + shell: bash + - name: Upload to S3 + uses: gravity-ui/preview-upload-to-s3-action@v1 + with: + src-path: storybook-static + dest-path: /graph/main/ + s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }} + s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..762e18d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ +name: Release + +on: + push: + branches: + - main + - release/v* + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Release from ${{ github.ref_name }} + uses: gravity-ui/release-action@v1 + with: + github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }} + npm-token: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }} + node-version: 18 + default-branch: ${{ github.ref_name != 'main' && github.ref_name || null }} + npm-dist-tag: ${{ github.ref_name != 'main' && 'untagged' || 'latest' }} \ No newline at end of file