-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add preview workflows, enforce changelog update (#5)
- Loading branch information
Showing
4 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,3 +55,6 @@ jobs: | |
run: yarn lint | ||
- name: Check prettier | ||
run: yarn prettify | ||
- name: Enforce changelog | ||
if: github.ref != 'refs/heads/main' | ||
uses: dangoslen/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Storybook Preview Deploy | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- labeled | ||
- synchronize | ||
|
||
env: | ||
NODE_VERSION: 16 | ||
NODE_CACHE: "yarn" | ||
|
||
jobs: | ||
deploy-preview: | ||
if: contains(github.event.pull_request.labels.*.name, 'preview') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
- name: Setup Node | ||
uses: actions/[email protected] | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: ${{ env.NODE_CACHE }} | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Build storybook | ||
run: yarn build:storybook | ||
- name: Get previous deployment | ||
uses: peter-evans/[email protected] | ||
id: get-deployment | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body-includes: "Storybook IPFS Hash: " | ||
- name: Setup Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.x" | ||
architecture: "x64" | ||
- name: Install pyyaml | ||
run: pip install --user pyyaml packaging | ||
- name: Install ipfs-cluster-ctl | ||
run: | | ||
wget https://dist.ipfs.io/ipfs-cluster-ctl/v1.0.0/ipfs-cluster-ctl_v1.0.0_linux-amd64.tar.gz | ||
tar xvfz ipfs-cluster-ctl_v1.0.0_linux-amd64.tar.gz | ||
- name: Unpin from IPFS | ||
continue-on-error: true | ||
if: steps.get-deployment.outputs.comment-id != 0 | ||
run: | | ||
COMMENT='${{ steps.get-deployment.outputs.comment-body }}' | ||
IFS=" " read -ra array <<< "$COMMENT" | ||
hash=${array[3]} | ||
./ipfs-cluster-ctl/ipfs-cluster-ctl --basic-auth '${{ secrets.IPFS_BASIC_AUTH }}' --host '${{ secrets.IPFS_HOST }}' pin rm $hash | ||
- name: Pin on IPFS | ||
id: ipfs-pin | ||
run: | | ||
ipfsResult="$(./ipfs-cluster-ctl/ipfs-cluster-ctl --basic-auth '${{ secrets.IPFS_BASIC_AUTH }}' --host '${{ secrets.IPFS_HOST }}' add -r './storybook-static' | tail -1)" | ||
IFS=" " read -ra array <<< "$ipfsResult" | ||
echo "hash=${array[1]}" >> $GITHUB_OUTPUT | ||
- name: Echo url | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
Storybook IPFS Hash: ${{ steps.ipfs-pin.outputs.hash }} | ||
ODS deployed to https://ipfs.eth.aragon.network/ipfs/${{ steps.ipfs-pin.outputs.hash }}/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Storybook Preview Remove | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- unlabeled | ||
- closed | ||
|
||
env: | ||
NODE_VERSION: 16 | ||
NODE_CACHE: "yarn" | ||
|
||
jobs: | ||
remove-preview: | ||
if: contains(github.event.pull_request.labels.*.name, 'preview') || github.event.label.name == 'preview' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install pyyaml | ||
run: pip install --user pyyaml packaging | ||
- name: Install ipfs-cluster-ctl | ||
run: | | ||
wget https://dist.ipfs.io/ipfs-cluster-ctl/v1.0.0/ipfs-cluster-ctl_v1.0.0_linux-amd64.tar.gz | ||
tar xvfz ipfs-cluster-ctl_v1.0.0_linux-amd64.tar.gz | ||
- name: Get deployment | ||
uses: peter-evans/[email protected] | ||
id: get-deployment | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body-includes: "Storybook IPFS Hash: " | ||
- name: Unpin from IPFS | ||
if: steps.get-deployment.outputs.comment-id != 0 | ||
run: | | ||
COMMENT='${{ steps.get-deployment.outputs.comment-body }}' | ||
IFS=" " read -ra array <<< "$COMMENT" | ||
hash=${array[3]} | ||
./ipfs-cluster-ctl/ipfs-cluster-ctl --basic-auth '${{ secrets.IPFS_BASIC_AUTH }}' --host '${{ secrets.IPFS_HOST }}' pin rm $hash | ||
- name: Delete Comment | ||
uses: actions/[email protected] | ||
if: steps.get-deployment.outputs.comment-id != 0 | ||
with: | ||
script: | | ||
github.rest.issues.deleteComment({ | ||
comment_id: ${{ steps.get-deployment.outputs.comment-id }}, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters