Compare commits

..

4 Commits

Author SHA1 Message Date
Omar Oughriss
bb1dea088f Update cookie
All checks were successful
Demo - Build & Deploy to Scaleway / build-and-push-image-lecoffre (push) Successful in 16s
Demo - Build & Deploy to Scaleway / deploy-to-scaleway-lecoffre (push) Successful in 3s
2025-07-25 17:02:51 +02:00
Omar Oughriss
222f5acc20 Delete logs 2025-07-25 17:02:44 +02:00
Omar Oughriss
b351d9f839 Add logs
All checks were successful
Demo - Build & Deploy to Scaleway / build-and-push-image-lecoffre (push) Successful in 15s
Demo - Build & Deploy to Scaleway / deploy-to-scaleway-lecoffre (push) Successful in 3s
2025-07-25 16:38:15 +02:00
Omar Oughriss
20a333c106 Update cicd to trigger when push legacy_dev 2025-07-25 16:38:05 +02:00
5 changed files with 19 additions and 97 deletions

View File

@ -1,8 +1,8 @@
name: Demo - Build & Deploy to Scaleway name: Demo - Build & Deploy to Scaleway
on: on:
push: push:
- [legacy_dev] branches: [legacy_dev]
env: env:
PROJECT_ID_LECOFFRE: 72d08499-37c2-412b-877e-f8af0471654a PROJECT_ID_LECOFFRE: 72d08499-37c2-412b-877e-f8af0471654a

View File

@ -1,8 +1,8 @@
name: Prod - Build & Deploy to Scaleway name: Prod - Build & Deploy to Scaleway
on: on:
push: schedule:
branches: [main] - cron: '00 20 * * *' # 20:00 UTC -> 22:00 CEST
env: env:
@ -18,16 +18,16 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
#- name: Setup SSH - name: Setup SSH
# run: | run: |
# mkdir -p ~/.ssh mkdir -p ~/.ssh
# echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
# chmod 600 ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa
# ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
# env: env:
# SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
#- name: Copy SSH - name: Copy SSH
# run: cp ~/.ssh/id_rsa id_rsa run: cp ~/.ssh/id_rsa id_rsa
- name: Login to Scaleway Container Registry - name: Login to Scaleway Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:

View File

@ -1,78 +0,0 @@
name: Test - Build & Deploy to Scaleway
on:
push:
branches: [test]
env:
PROJECT_ID_LECOFFRE: 72d08499-37c2-412b-877e-f8af0471654a
NAMESPACE_ID_LECOFFRE: e2036b1d-b5c1-4cdd-b168-d895c498f679
CONTAINER_REGISTRY_ENDPOINT_LECOFFRE: rg.fr-par.scw.cloud/funcscwlecoffretestfhhn6rcl
IMAGE_NAME: front
CONTAINER_NAME: front
jobs:
build-and-push-image-lecoffre:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Copy SSH
run: cp ~/.ssh/id_rsa id_rsa
- name: Login to Scaleway Container Registry
uses: docker/login-action@v3
with:
username: nologin
password: ${{ secrets.SCW_SECRET_KEY_LECOFFRE }}
registry: ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}
- name: Get Git Commit SHA
id: vars
run: echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build the Docker Image
run: docker build . -t ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }}
- name: Push the Docker Image to Scaleway Container Registry
run: docker push ${{ env.CONTAINER_REGISTRY_ENDPOINT_LECOFFRE }}/${{ env.IMAGE_NAME }}
deploy-to-scaleway-lecoffre:
needs: build-and-push-image-lecoffre
runs-on: ubuntu-latest
environment: preprod
steps:
- name: Install CLI
uses: scaleway/action-scw@v0
- name: Get container ID
run: |
echo "CONTAINER_ID=$(scw container container list namespace-id=${{env.NAMESPACE_ID_LECOFFRE}} -o json | jq -r '.[] | select(.name == "${{ env.CONTAINER_NAME }}") | .id')" >> $GITHUB_ENV
env:
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY_LECOFFRE }}
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY_LECOFFRE }}
SCW_DEFAULT_PROJECT_ID: ${{ env.PROJECT_ID_LECOFFRE }}
SCW_DEFAULT_ORGANIZATION_ID: ${{ secrets.SCW_ORGANIZATION_ID_LECOFFRE }}
- name: Deploy the container based on the new image
run: |
env_string=""
while IFS= read -r line; do
if [[ "$line" == *"="* ]]; then
key=$(echo "$line" | cut -d '=' -f 1)
value=$(echo "$line" | cut -d '=' -f 2-)
if [[ -n "$key" ]]; then
env_string+="environment-variables.$key=$value "
fi
fi
done <<< "$ENV_VARS"
env_string=$(echo $env_string | sed 's/ $//')
scw container container update ${{ env.CONTAINER_ID }} $env_string
env:
ENV_VARS: ${{ secrets.ENV }}
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY_LECOFFRE }}
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY_LECOFFRE }}
SCW_DEFAULT_PROJECT_ID: ${{ env.PROJECT_ID_LECOFFRE }}
SCW_DEFAULT_ORGANIZATION_ID: ${{ secrets.SCW_ORGANIZATION_ID_LECOFFRE }}

View File

@ -7,10 +7,10 @@ COPY package.json ./
RUN apk update && apk add openssh-client git RUN apk update && apk add openssh-client git
#COPY id_rsa /root/.ssh/id_rsa COPY id_rsa /root/.ssh/id_rsa
#RUN chmod 600 ~/.ssh/id_rsa RUN chmod 600 ~/.ssh/id_rsa
#RUN eval "$(ssh-agent -s)" && ssh-add /root/.ssh/id_rsa RUN eval "$(ssh-agent -s)" && ssh-add /root/.ssh/id_rsa
#RUN ssh-keyscan github.com smart-chain-fr/leCoffre-resources.git >> /root/.ssh/known_hosts RUN ssh-keyscan github.com smart-chain-fr/leCoffre-resources.git >> /root/.ssh/known_hosts
RUN npm install --frozen-lockfile RUN npm install --frozen-lockfile

View File

@ -15,7 +15,7 @@ export default class CookieService {
const date = new Date(); const date = new Date();
// Set it expire in 7 days // Set it expire in 7 days
date.setTime(date.getTime() + 7 * 24 * 60 * 60 * 1000); date.setTime(date.getTime() + 3 * 60 * 1000);
// Set it // Set it
document.cookie = name + "=" + value + "; expires=" + date.toUTCString() + "; path=/"; document.cookie = name + "=" + value + "; expires=" + date.toUTCString() + "; path=/";