Skip to content

Add references to CC_PREVENT_LOGSCOLLECTION, CC_DISABLE_JVM_AGENT and CC_DISABLE_METRICS #128

Add references to CC_PREVENT_LOGSCOLLECTION, CC_DISABLE_JVM_AGENT and CC_DISABLE_METRICS

Add references to CC_PREVENT_LOGSCOLLECTION, CC_DISABLE_JVM_AGENT and CC_DISABLE_METRICS #128

Workflow file for this run

name: Review app on pull request
on:
pull_request_target:
types: [opened, closed, synchronize, reopened]
branches: [ main ]
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
CLEVER_SECRET: ${{ secrets.CLEVER_SECRET }}
CLEVER_TOKEN: ${{ secrets.CLEVER_TOKEN }}
ORGA_ID: ${{ secrets.ORGA_ID }}
HUGO_VERSION: ${{ secrets.HUGO_VERSION }}
jobs:
deploy:
if: github.event.action == 'opened' || github.event.action == 'reopened'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: read
environment:
name: PR review apps
#url: clever-doc-preprod-${{ env.BRANCH_NAME }}.cleverapps.io
steps:
- run: echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Configure Git
run: |
git config user.email "julia.navarro@clever-cloud.com"
git config user.name "Julia"
- name: Setup SSH
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Add forked repository as remote and pull changes
if: github.event.pull_request.head.repo.fork
run: |
git remote add ${{ github.event.pull_request.user.login }} git@github.com:${{ github.event.pull_request.head.repo.full_name }}.git
git fetch ${{ github.event.pull_request.user.login }}
git checkout -b ${{ github.event.pull_request.head.ref }}-PR-${{ github.event.pull_request.number }}
git pull ${{ github.event.pull_request.user.login }} ${{ github.event.pull_request.head.ref }} --no-rebase
- run: echo "πŸ’‘ The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "πŸ–₯️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
- name: install clever-tools
run: npm install -g clever-tools
- name: Create app and configure app
run: |
clever login --token ${{ env.CLEVER_TOKEN }} --secret ${{ env.CLEVER_SECRET }}
clever create --type static-apache doc-review-${{ env.BRANCH_NAME }} --alias doc-review-${{ env.BRANCH_NAME }} --region par --org ${{secrets.ORGA_ID}}
clever env set CC_PRE_BUILD_HOOK "./clevercloud-deploy-script.sh"
clever env set CC_WEBROOT "/public"
clever env set HUGO_ENV "production"
clever env set HUGO_VERSION ${{env.HUGO_VERSION}}
clever domain add clever-doc-review-${{ env.BRANCH_NAME }}.cleverapps.io
- name: Deploy
run: clever deploy
- name: Comment PR
uses: actions/github-script@v5
with:
script: |
const issue_number = context.payload.pull_request.number;
const message = `Deployment has finished πŸ‘οΈπŸ‘„πŸ‘οΈ Your app is available [here](https://clever-doc-review-${process.env.BRANCH_NAME}.cleverapps.io)`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: message
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update:
if: github.event.action == 'synchronize'
runs-on: ubuntu-latest
permissions:
issues: write
contents: read
pull-requests: write
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Configure Git
run: |
git config user.email "julia.navarro@clever-cloud.com"
git config user.name "Julia"
- name: Setup SSH
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Add forked repository as remote and pull changes
if: github.event.pull_request.head.repo.fork
run: |
git remote add ${{ github.event.pull_request.user.login }} git@github.com:/${{ github.event.pull_request.head.repo.full_name }}.git
git fetch ${{ github.event.pull_request.user.login }}
git checkout ${{ github.event.pull_request.head.ref }}-PR-${{ github.event.pull_request.number }}
git pull ${{ github.event.pull_request.user.login }} ${{ github.event.pull_request.head.ref }} --no-rebase
- name: install clever-tools
run: npm install -g clever-tools
- name: Link and update app
run: |
clever link -o ${{ env.ORGA_ID }} doc-review-${{ env.BRANCH_NAME }}
clever deploy
- name: Comment PR
uses: actions/github-script@v5
with:
script: |
const issue_number = context.payload.pull_request.number;
const message = `πŸš€ Your app has been updated and is available [here](https://clever-doc-review-${process.env.BRANCH_NAME}.cleverapps.io)`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: message
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
delete:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
if: always() && github.event_name == 'pull_request_target' && github.event.action == 'closed'
steps:
- name: install clever-tools
run: npm install -g clever-tools
- name: Delete app
run: |
clever login --token ${{ env.CLEVER_TOKEN }} --secret ${{ env.CLEVER_SECRET }}
clever link -o ${{ env.ORGA_ID }} doc-review-${{ env.BRANCH_NAME }}
clever delete --alias doc-review-${{ env.BRANCH_NAME }} --yes
- name: Comment PR
uses: actions/github-script@v5
with:
script: |
const issue_number = context.payload.pull_request.number;
const message = `Your review app has been deleted πŸ‘‹`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: message
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}