Add poc website #156
Workflow file for this run
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: Deploy Pull Request | |
on: | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
MagaLinter: | |
name: MegaLinter | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
steps: | |
# Git Checkout | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} | |
fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances | |
# MegaLinter | |
- name: MegaLinter | |
id: ml | |
# You can override MegaLinter flavor used to have faster performances | |
# More info at https://megalinter.io/latest/flavors/ | |
uses: oxsecurity/megalinter@latest | |
env: | |
# All available variables are described in documentation | |
# https://megalinter.io/latest/configuration/ | |
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} # Validates all source when push on main, else just the git diff with main. Override with true if you always want to lint all sources | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY | |
# DISABLE: COPYPASTE,SPELL # Uncomment to disable copy-paste and spell checks | |
# Upload MegaLinter artifacts | |
- name: Archive production artifacts | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: MegaLinter reports | |
path: | | |
megalinter-reports | |
mega-linter.log | |
Project-Build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 21 | |
cache: gradle | |
- name: Build with Gradle | |
run: ./gradlew build --no-daemon --build-cache | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | |
- name: Build and Push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: true | |
tags: | | |
commongroundproject/backend:pr-${{ github.event.number }} | |
commongroundproject/backend:${{ github.sha }} | |
context: . | |
Deploy-Snapshot: | |
needs: Project-Build | |
runs-on: [self-hosted, linux] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh | |
echo '${{ secrets.DEV_DEPLOY_PRIVATE_KEY }}' >> ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
- name: Deploy image | |
env: | |
title: ${{ github.event.pull_request.title }} | |
run: | | |
export MODE='Snapshot' | |
export ENV='${{ github.event.number }}' | |
export DRAFT='${{ github.event.pull_request.draft }}' | |
export TITLE='${{ env.title }}' | |
ssh -o SendEnv=MODE -o SendEnv=ENV -o SendEnv=TITLE -o SendEnv=DRAFT -i ~/.ssh/id_rsa [email protected] | |
- name: Clear up | |
run: rm ~/.ssh/id_rsa |