Skip to content

Continuous Integration (PR opened) #3705

Continuous Integration (PR opened)

Continuous Integration (PR opened) #3705

Workflow file for this run

name: Continuous Integration (PR opened)
on:
workflow_run:
workflows: ["Continuous Integration"]
types:
- completed
jobs:
download-artifact:
name: Download artifact
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
outputs:
pr-number: ${{ steps.set-pr-number.outputs.pr-number }}
steps:
- id: set-pr-number
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return /^storybooks-/.test(artifact.name);
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{ github.workspace }}/storybooks.zip', Buffer.from(download.data));
const prNumber = /^storybooks-(\d+)$/.exec(matchArtifact.name)[1];
console.log(`::set-output name=pr-number::${ prNumber }`);
- run: unzip storybooks.zip
- uses: actions/upload-artifact@v2
with:
name: storybooks
path: |
fuselage/storybook-static
onboarding-ui/storybook-static
layout/storybook-static
publish-to-gh-pages:
name: Publish to GitHub Pages
needs:
- download-artifact
runs-on: ubuntu-latest
environment:
name: github-pages
url: "https://rocketchat.github.io/fuselage/fuselage/${{ needs.download-artifact.outputs.pr-number }}"
steps:
- uses: actions/checkout@v2
with:
ref: gh-pages
- uses: actions/download-artifact@v2
with:
name: storybooks
path: packages
- run: |
rm -rf "fuselage/${{ needs.download-artifact.outputs.pr-number }}" "layout/${{ needs.download-artifact.outputs.pr-number }}" "uikit-playground/${{ needs.download-artifact.outputs.pr-number }}" "onboarding-ui/${{ needs.download-artifact.outputs.pr-number }}"
mv -v packages/fuselage/storybook-static "fuselage/${{ needs.download-artifact.outputs.pr-number }}"
mv -v packages/onboarding-ui/storybook-static "onboarding-ui/${{ needs.download-artifact.outputs.pr-number }}"
mv -v packages/layout/storybook-static "layout/${{ needs.download-artifact.outputs.pr-number }}"
rm -rf packages
- uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: .
commit_message: "Deploy to Github Pages [skip ci]"
jekyll: false
env:
GITHUB_TOKEN: ${{ github.token }}