From 8317a6dc4c9ff2e3078c5caeb5040287a0e7be7a Mon Sep 17 00:00:00 2001 From: Sarka Chwastkova Date: Wed, 15 Jan 2025 16:47:02 +0100 Subject: [PATCH] chore: add Playroom deployment --- .github/workflows/playroom.yml | 34 +++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 10 ++++++++++ .github/workflows/storybook.yml | 6 +++++- 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/playroom.yml diff --git a/.github/workflows/playroom.yml b/.github/workflows/playroom.yml new file mode 100644 index 0000000000..c834dd69d1 --- /dev/null +++ b/.github/workflows/playroom.yml @@ -0,0 +1,34 @@ +name: Playroom + +on: + push: + # Pattern matched against refs/tags + tags: + - "*" + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + pull-requests: write # for dependabot + contents: write # for deploying to GitHub Pages on master + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Node + uses: ./.github/actions/node + + # Get the number of the latest tag + - name: Version test + run: | + git fetch --tags --quiet + echo "VERSION_TAG=$(git tag --list '@kiwicom/orbit-components@*' --sort=creatordate | sed '$!d' | sed -n '$ s|.*@||; s/\./-/gp')" >> $GITHUB_ENV + + # Create an URL for the Playroom + - name: Get DOMAIN + run: echo "DOMAIN=https://kiwicom-orbit-v${VERSION_TAG}.surge.sh" >> $GITHUB_ENV + + - name: Deploy to staging + run: echo $DOMAIN + # run: yarn components deploy:surge ${DOMAIN} --token ${{ secrets.SURGE_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0efeda7aed..924fbc6271 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -72,3 +72,13 @@ jobs: yarn docs changelog git add docs/src/data/log.md && git commit -m "docs: update changelog" && git push yarn zx scripts/post-changelog.mjs + + - name: Get tag version + run: | + git fetch --tags --quiet + echo "VERSION_TAG=$(git tag --list '@kiwicom/orbit-components@*' --sort=creatordate | sed '$!d' | sed -n '$ s|.*@||; s/\./-/gp')" >> $GITHUB_ENV + + - name: Get Storybook domain + run: | + echo "DOMAIN=https://kiwicom-orbit-v${VERSION_TAG}.surge.sh" >> $GITHUB_ENV + yarn components deploy:surge ${DOMAIN} --token ${{ secrets.SURGE_TOKEN }} diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index 213d8a16b2..ecde65f1ad 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -52,6 +52,10 @@ jobs: if: github.ref != 'refs/heads/master' run: echo "DOMAIN=https://kiwicom-orbit-${BRANCH_URL}.surge.sh" >> $GITHUB_ENV + - name: Get Playroom DOMAIN + if: github.ref != 'refs/heads/master' + run: echo "DOMAIN_PLAYROOM=${DOMAIN}/playroom" >> $GITHUB_ENV + - name: Deploy to staging if: github.ref != 'refs/heads/master' run: yarn components deploy:surge ${DOMAIN} --token ${{ secrets.SURGE_TOKEN }} @@ -61,7 +65,7 @@ jobs: uses: actions/github-script@v6 with: script: | - const commentBody = `Storybook staging is available at ${process.env.DOMAIN}`; + const commentBody = `Storybook staging is available at ${process.env.DOMAIN}\n Playroom staging is available at ${process.env.DOMAIN_PLAYROOM}`; const commentsList = await github.rest.issues.listComments({ issue_number: context.issue.number,