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
name: Cleanup | |
on: | |
pull_request: | |
types: [closed, unlabeled] | |
branches: | |
- maintenance-3.0.x | |
env: | |
GKE_CLUSTER: jx-prod | |
GKE_ZONE: us-east1-b | |
jobs: | |
cleanup: | |
name: Preview | |
if: (github.event.action == 'unlabeled' && github.event.label.name == 'preview') || contains(github.event.pull_request.labels.*.name, 'preview') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prepare environment | |
run: | | |
BRANCH_NAME=${GITHUB_HEAD_REF##*/} | |
echo "PREVIEW_NAMESPACE=storybook-$(echo $BRANCH_NAME | sed 's/[^[:alnum:]-]/-/g' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Get GKE credentials | |
uses: google-github-actions/[email protected] | |
with: | |
cluster_name: ${{ env.GKE_CLUSTER }} | |
location: ${{ env.GKE_ZONE }} | |
project_id: ${{ secrets.GKE_PROJECT }} | |
credentials: ${{ secrets.GKE_SA_KEY }} | |
- name: Cleanup preview namespace | |
continue-on-error: true | |
run: | | |
kubectl delete ns ${PREVIEW_NAMESPACE} | |
webui-cleanup: | |
runs-on: ubuntu-latest | |
if: (github.event.action == 'unlabeled' && github.event.label.name == 'webui-preview') || contains(github.event.pull_request.labels.*.name, 'webui-preview') | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Prepare environment | |
run: | | |
echo "BRANCH_NAME=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV | |
- name: Web UI preview | |
uses: nuxeo/ui-team-gh-actions/trigger-workflow@a5b89f35e0d1f3a912f528d7f1c3acdb73c60549 | |
with: | |
owner: nuxeo | |
repo: nuxeo-web-ui | |
workflow-id: clean.yaml | |
access-token: ${{ secrets.WEBUI_ACCESS_TOKEN_PERSONAL }} | |
branch-name: maintenance-3.0.x | |
inputs: | | |
branch_name: ${{ env.BRANCH_NAME }} |