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..a13654acf7 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -50,7 +50,14 @@ jobs: - name: Get DOMAIN if: github.ref != 'refs/heads/master' - run: echo "DOMAIN=https://kiwicom-orbit-${BRANCH_URL}.surge.sh" >> $GITHUB_ENV + run: | + echo "DOMAIN=https://kiwicom-orbit-${BRANCH_URL}.surge.sh" >> $GITHUB_ENV + echo "DOMAIN_PLAYROOM=${env.DOMAIN}/playroom" >> $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' @@ -61,7 +68,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,