Skip to content

Merge pull request #129 from beabee-communityrm/chore/embed-block #134

Merge pull request #129 from beabee-communityrm/chore/embed-block

Merge pull request #129 from beabee-communityrm/chore/embed-block #134

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
- dev
tags:
- v*
jobs:
check:
uses: ./.github/workflows/check.yml
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: yarn presetup
- run: yarn test
working-directory: ./apps/backend
init:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
version: ${{ steps.meta.outputs.version }}
json: ${{ steps.meta.outputs.json }}
steps:
- uses: actions/checkout@v4
- uses: docker/metadata-action@v5
id: meta
with:
flavor: |
latest=false
tags: |
type=ref,event=tag
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
type=raw,value=release,enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }}
build-push-backend:
runs-on: ubuntu-latest
needs: [check, test, init]
strategy:
matrix:
tag: ${{ fromJSON(needs.init.outputs.json).tags }}
steps:
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push legacy app
uses: docker/build-push-action@v5
with:
file: ./packages/docker/base.dockerfile
push: true
build-args: |
REVISION=${{ github.sha }}
labels: ${{ needs.init.outputs.labels }}
target: legacy_app
tags: ${{ secrets.DOCKER_ORGANISATION }}/beabee-legacy-app:${{ matrix.tag }}
- name: Build and push API app
uses: docker/build-push-action@v5
with:
file: ./packages/docker/base.dockerfile
push: true
build-args: |
REVISION=${{ github.sha }}
labels: ${{ needs.init.outputs.labels }}
target: api_app
tags: ${{ secrets.DOCKER_ORGANISATION }}/beabee-api-app:${{ matrix.tag }}
- name: Build and push webhook app
uses: docker/build-push-action@v5
with:
file: ./packages/docker/base.dockerfile
push: true
build-args: |
REVISION=${{ github.sha }}
labels: ${{ needs.init.outputs.labels }}
target: webhook_app
tags: ${{ secrets.DOCKER_ORGANISATION }}/beabee-webhook-app:${{ matrix.tag }}
- name: Build and push cron app
uses: docker/build-push-action@v5
with:
file: ./packages/docker/base.dockerfile
push: true
build-args: |
REVISION=${{ github.sha }}
labels: ${{ needs.init.outputs.labels }}
target: cron_app
tags: ${{ secrets.DOCKER_ORGANISATION }}/beabee-cron-app:${{ matrix.tag }}
build-push-frontend:
runs-on: ubuntu-latest
needs: [check, test, init]
strategy:
matrix:
tag: ${{ fromJSON(needs.init.outputs.json).tags }}
steps:
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push frontend app
uses: docker/build-push-action@v5
with:
file: ./apps/frontend/Dockerfile
push: true
build-args: |
VERSION=${{ needs.init.outputs.version }}
REVISION=${{ github.sha }}
labels: ${{ needs.init.outputs.labels }}
tags: ${{ secrets.DOCKER_ORGANISATION }}/beabee-frontend:${{ matrix.tag }}
build-push-router:
runs-on: ubuntu-latest
needs: [check, test, init]
strategy:
matrix:
tag: ${{ fromJSON(needs.init.outputs.json).tags }}
steps:
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push router app
uses: docker/build-push-action@v5
with:
file: ./apps/router/Dockerfile
push: true
build-args: |
REVISION=${{ github.sha }}
labels: ${{ needs.init.outputs.labels }}
tags: ${{ secrets.DOCKER_ORGANISATION }}/beabee-router:${{ matrix.tag }}
release:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
needs: [init, build-push-backend, build-push-frontend, build-push-router]
steps:
- uses: actions/checkout@v4
with:
repository: beabee-communityrm/hive-deploy-stack
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
ref: main
- run: |
git config --global user.name "Deploy bot"
git config --global user.email "<>"
echo -n ${{ needs.init.outputs.version }} > VERSION
./update.sh
git add VERSION docker-compose.yml
if ! git diff --quiet --cached; then
git commit -m "Deploy version ${{ needs.init.outputs.version }}"
git push
fi