Skip to content

wip: migration from Travis CI to GitHub Actions #149 #26

wip: migration from Travis CI to GitHub Actions #149

wip: migration from Travis CI to GitHub Actions #149 #26

Workflow file for this run

name: Build & Deploy
on: [push]
env:
TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }}
jobs:
test:
if: ${{ !contains(github.event.head_commit.message, '[skip test]') }}
runs-on: ubuntu-latest
env:
DB_URL: "mongodb://mongo:27017"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ secrets.NODE_VERSION }}
- name: Start MongoDB
uses: timgchile/[email protected]
with:
mongodb-version: 6.0
- name: Run tests
run: |
chmod +x ./.github/workflows/test.sh
./.github/workflows/test.sh
build:
if: ${{ !contains(github.event.head_commit.message, '[skip app]') }}
runs-on: ubuntu-latest
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ secrets.NODE_VERSION }}
- name: Build & deploy
run: |
chmod +x ./.github/workflows/build.sh
./.github/workflows/build.sh
doc:
if: ${{ contains(github.event.head_commit.message, '[build doc]') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ secrets.NODE_VERSION }}
- name: Build doc
run: |
chmod +x ./.github/workflows/doc.sh
./.github/workflows/doc.sh
- name: Deploy doc to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/.vitepress/dist
slackNotification:
name: Notify on slack
runs-on: ubuntu-latest
if: ${{ always() }}
needs: [test, build, doc]
steps:
- uses: actions/checkout@v4
- name: Notify on slack
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_APPS }}
SLACK_USERNAME: GitHub Actions
SLACK_ICON: https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png
SLACK_COLOR: ${{ (needs.test.result == 'failure' || needs.build.result == 'failure' || needs.doc.result == 'failure') && 'danger' || 'good' }}
SLACK_MESSAGE: Build of ${{ github.repository }}@${{ github.ref_name }} by ${{ github.actor }} ${{ (needs.test.result == 'failure' || needs.build.result == 'failure' || needs.doc.result == 'failure') && 'failed' || 'passed' }}
SLACK_FOOTER: