Merge pull request #5 from gibbon-lab/alexandre-marre-update-project-… #20
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: CI | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
lint-backend: | |
runs-on: ubuntu-latest | |
container: node:22.3.0-alpine3.19 | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
- name: Install dependencies and lint javascript | |
run: | | |
cd backend | |
yarn install --frozen-lockfile | |
yarn lint | |
lint-frontend: | |
runs-on: ubuntu-latest | |
container: node:22.3.0-alpine3.19 | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
- name: Install dependencies and lint javascript | |
run: | | |
cd frontend | |
yarn install --frozen-lockfile | |
yarn lint | |
test-backend: | |
needs: [lint-backend] | |
runs-on: ubuntu-latest | |
container: node:22.3.0-alpine3.19 | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
- name: Install dependencies and test backend | |
run: | | |
cd backend | |
yarn install --frozen-lockfile | |
yarn test | |
test-build-docker-image: | |
needs: [lint-backend, lint-frontend, test-backend] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.GIBBON_LAB_DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.GIBBON_LAB_DOCKER_REGISTRY_PASSWORD }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
tags: gibbonlab/gibbon-mail:test-build-ci | |
file: docker-image/Dockerfile | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
pre-release: | |
name: "Pre Release" | |
needs: [lint-backend, lint-frontend, test-backend, test-build-docker-image] | |
if: ${{ github.repository == 'gibbon-lab/gibbon-mail' && contains(github.ref, 'refs/heads/master') }} | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.GIBBON_LAB_DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.GIBBON_LAB_DOCKER_REGISTRY_PASSWORD }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: gibbonlab/gibbon-mail:latest | |
file: docker-image/Dockerfile | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: true | |
title: "Development Build" | |
tagged-release: | |
name: "Tagged Release" | |
needs: [lint-backend, lint-frontend, test-backend, test-build-docker-image] | |
if: ${{ github.repository == 'gibbon-lab/gibbon-mail' && contains(github.ref, 'refs/tags/v') }} | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
- name: Generate version variable | |
id: branch_name | |
run: echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.GIBBON_LAB_DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.GIBBON_LAB_DOCKER_REGISTRY_PASSWORD }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: gibbonlab/gibbon-mail:${{ steps.branch_name.outputs.TAG_VERSION }} | |
file: docker-image/Dockerfile | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '22.3.0' | |
registry-url: 'https://registry.npmjs.org' | |
- run: scripts/deploy-to-npm.sh | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GIBBON_LAB_NPM_TOKEN }} | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: false |