robotcoral/coral-app

View on GitHub
.github/workflows/cd.yml

Summary

Maintainability
Test Coverage
name: CD
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
version:
# Friendly description to be shown in the UI instead of 'name'
description: "Version number"
# Default value if no value is explicitly provided
default: "0.0.0"
# Input has to be provided for the workflow to run
required: true
jobs:
build_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.CI_PERSONAL_TOKEN }}
 
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
 
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.PRIVATE_KEY_CI }}
passphrase: ${{ secrets.PASSWORD_KEY_CI }}
git_user_signingkey: true
git_commit_gpgsign: true
 
- name: Bump versions
run: python3 bumpversion.py ${{ github.event.inputs.version }}
 
- name: Commit changes
run: |
git config --global user.name 'robotcoralci'
git config --global user.email 'robotcoralci@users.noreply.github.com'
git commit -S -am "chore: bump version to ${{ github.event.inputs.version }}"
git push
 
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "14"
 
- name: Install dependencies
run: npm ci --no-optional
 
- name: Build production files
run: npm run build --production
 
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
 
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
 
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
 
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: robotcoralci
password: ${{ secrets.CI_PERSONAL_TOKEN }}
 
- name: Build and push to Docker registries
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
platforms: linux/386, linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8, linux/ppc64le, linux/s390x
file: ./Dockerfile
push: true
tags: |
robotcoral/coral-app:latest
robotcoral/coral-app:${{ github.event.inputs.version }}
ghcr.io/robotcoral/coral-app:latest
ghcr.io/robotcoral/coral-app:${{ github.event.inputs.version }}
 
- name: Create Release strings
id: release_strings
run: |
echo "RELEASE_TAG=${{ github.event.inputs.version }}" >> $GITHUB_ENV
echo "RELEASE_NAME=Version ${{ github.event.inputs.version }}" >> $GITHUB_ENV
echo "RELEASE_FILENAME=coral-app-${{ github.event.inputs.version }}.zip" >> $GITHUB_ENV
 
- name: Zip output files
run: |
cd dist/coral-app/
zip -r "${{ env.RELEASE_FILENAME }}" *
mv "${{ env.RELEASE_FILENAME }}" ../../
cd ../../
 
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_TAG }}
name: ${{ env.RELEASE_NAME }}
files: |
${{ env.RELEASE_FILENAME }}
 
- name: Trigger version bump in documentation
uses: peter-evans/repository-dispatch@v1
with:
repository: robotcoral/coral-docs
token: ${{ secrets.CI_PERSONAL_TOKEN }}
event-type: sync_version
 
- name: Invoke deployment hook
uses: distributhor/workflow-webhook@v2
env:
webhook_url: ${{ secrets.DEPLOY_STABLE_WEBHOOK }}
webhook_secret: ${{ secrets.DEPLOY_STABLE_SECRET }}
silent: true