Skip to content

Add FCM key during workflow from Github secret - Fixes #25 #33

Add FCM key during workflow from Github secret - Fixes #25

Add FCM key during workflow from Github secret - Fixes #25 #33

Workflow file for this run

name: Build
on:
push:
branches:
- main
- stable
tags:
- v*
env:
REGISTRY: bikenow.vkw.tu-dresden.de
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
runs-on: ubuntu-latest
container: python:3.9
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install dependencies
run: poetry install
- name: Run unit tests
run: |
cd backend
poetry run python manage.py test
publish:
runs-on: self-hosted
needs: test
container: docker:latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.NEXUS_DOCKER_PUB_USERNAME }}
password: ${{ secrets.NEXUS_DOCKER_PUB_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
# See: https://github.com/docker/metadata-action
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Perpare Firebase Cloud messaging secret
run: |
echo "$FIREBASE_CLOUD_MESSAGING_KEY_JSON_BASE64" | base64 --decode > config/fcm-key.json
env:
FIREBASE_CLOUD_MESSAGING_KEY_JSON_BASE64: ${{ secrets.FIREBASE_CLOUD_MESSAGING_KEY_JSON_BASE64 }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}