From e61e489c2469aba803fe4feab11852b3e409d037 Mon Sep 17 00:00:00 2001 From: Zain Syed Date: Fri, 14 Oct 2022 15:09:38 -0400 Subject: [PATCH] fix: restored release branch pre-release build --- .../workflows/build-and-deploy-storybooks.yml | 60 ------------------- .github/workflows/pre-release.yml | 36 +++++++++++ .../workflows/publish-package-on-release.yml | 33 ++++++++++ .github/workflows/release-please.yml | 6 +- 4 files changed, 71 insertions(+), 64 deletions(-) delete mode 100644 .github/workflows/build-and-deploy-storybooks.yml create mode 100644 .github/workflows/pre-release.yml diff --git a/.github/workflows/build-and-deploy-storybooks.yml b/.github/workflows/build-and-deploy-storybooks.yml deleted file mode 100644 index 37047ba4..00000000 --- a/.github/workflows/build-and-deploy-storybooks.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Build and Deploy Storybooks -on: - push: - branches: - - main - paths: - - 'package.json' - - 'CHANGELOG.md' -jobs: - build-and-deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout ๐Ÿ›Ž๏ธ - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Node - uses: actions/setup-node@v3 - with: - node-version: 16 - registry-url: 'https://registry.npmjs.org' - - name: Install ๐Ÿ”ง - run: npm ci - - name: Test ๐Ÿงช - run: npm run test - env: - CI: true - - name: Build Storybooks ๐Ÿ”จ - run: npm run build-storybook - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - name: Deploy ๐Ÿš€ - uses: JamesIves/github-pages-deploy-action@3.6.2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - TARGET_FOLDER: ${{ steps.extract_branch.outputs.branch }} - BRANCH: gh-pages # The branch the action should deploy to. - FOLDER: storybook-static # The folder the action should deploy. - CLEAN: true # Automatically remove deleted files from the deploy branch - - name: Find Comment - if: steps.extract_branch.outputs.branch != 'main' - uses: peter-evans/find-comment@v1 - id: fc - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: | - Storybooks Link For Branch - https://dts-stn.github.io/Service-Canada-Design-System/${{ steps.extract_branch.outputs.branch }} - - name: Create or update comment # comment in pull request storybooks link - if: steps.extract_branch.outputs.branch != 'main' - uses: peter-evans/create-or-update-comment@v1 - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - body: | - Storybooks Link For Branch - https://dts-stn.github.io/Service-Canada-Design-System/${{ steps.extract_branch.outputs.branch }} \ No newline at end of file diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 00000000..86bc3e2a --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,36 @@ +name: Generate Pre-release +on: + push: + branches: + - release +jobs: + pre-release: + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Node + uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: 'https://registry.npmjs.org' + - name: Install ๐Ÿ”ง + run: npm ci + - name: Test ๐Ÿงช + run: npm run test + env: + CI: true + - name: Create Tarball + run: npm pack + - name: Pre Release + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: latest + prerelease: true + title: Development Build + files: | + *.tgz + diff --git a/.github/workflows/publish-package-on-release.yml b/.github/workflows/publish-package-on-release.yml index 46999603..0e011225 100644 --- a/.github/workflows/publish-package-on-release.yml +++ b/.github/workflows/publish-package-on-release.yml @@ -33,3 +33,36 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN_DTSSTN_LOCAL }} + - name: Build Storybooks ๐Ÿ”จ + run: npm run build-storybook + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + - name: Deploy ๐Ÿš€ + uses: JamesIves/github-pages-deploy-action@3.6.2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + TARGET_FOLDER: ${{ steps.extract_branch.outputs.branch }} + BRANCH: gh-pages # The branch the action should deploy to. + FOLDER: storybook-static # The folder the action should deploy. + CLEAN: true # Automatically remove deleted files from the deploy branch + - name: Find Comment + if: steps.extract_branch.outputs.branch != 'main' + uses: peter-evans/find-comment@v1 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: | + Storybooks Link For Branch + https://dts-stn.github.io/Service-Canada-Design-System/${{ steps.extract_branch.outputs.branch }} + - name: Create or update comment # comment in pull request storybooks link + if: steps.extract_branch.outputs.branch != 'main' + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | + Storybooks Link For Branch + https://dts-stn.github.io/Service-Canada-Design-System/${{ steps.extract_branch.outputs.branch }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 8839bd8e..ef7f8e4d 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -8,7 +8,7 @@ on: name: release-please jobs: release-please: - if: github.event.pull_request.merged == true + if: startsWith(github.head_ref, 'release-please-') == false && github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - uses: google-github-actions/release-please-action@v3 @@ -16,6 +16,4 @@ jobs: release-type: node package-name: 'dts-stn/service-canada-design-system' changelog-types: '[{"type":"feat","section":"Features"},{"type":"fix","section":"Bug Fixes"},{"type":"perf","section":"Performance Improvements"},{"type":"test","section":"Tests"},{"type":"docs","section":"Documentation"},{"type":"build","section":"Build System"},{"type":"ops","section":"CI/CD Changes"},{"type":"chore","section":"Miscellaneous Chores"},{"type":"refactor","section":"Refactored"}]' - prerelease: true - default-branch: main - +