Coder Social home page Coder Social logo

teko-github-actions's Introduction

TEKO GitHub Actions

Automatic release

Build and deploy PHP app to Azure Web App

Inhaltsverzeichnis

Einleitung

In unserer Vertiefungsarbeit bei der TEKO im Fach Programmieren Teil 1 werden meyerf99 & quattro99 das Thema GitHub Actions näher erläutern.

Dieses Git Repository ist ein Bestandteil der Vertiefungsarbeit und zeigt untenstehend auf, wie das Game mithilfe von GitHub Actions zu Microsoft Azure Web App deployed werden kann und wie mithilfe eines Git Tag's ein Release erstellt wird.

Installation

Microsoft Azure App Service

Voraussetzung

Konfiguration

Erstellung eines Microsoft Azure Web App Service mithilfe von Azure CLI.

Beispiel

# Verbindung zu Microsoft Azure Tenant herstellen
az login 

# Erstellung Ressource Gruppe
az group create -l switzerlandnorth -n rg-teko-github-actions-prod-switzerlandnorth

# Erstellung App Service Plan
az appservice plan create -g rg-teko-github-actions-prod-switzerlandnorth -n asp-teko-github-actions-prod-switzerlandnorth-001 --is-linux --sku FREE

# Erstellung App im erstellten App Service Plan
az webapp create -g rg-teko-github-actions-prod-switzerlandnorth -p asp-teko-github-actions-prod-switzerlandnorth-001 -n teko-github-actions-prod-switzerlandnorth-001 --runtime "php:8.0" --https-only true

GitHub Actions

Voraussetung

  • GitHub Account
  • Repository -> z.B. dieses Repository forken

Konfiguration

Automatisiertes Azure Web App Deployment
  1. Wechsle auf dem GitHub Repository den Reiter zu Actions

  1. Im Suchfeld folgendes eingeben Deploy a PHP app to an Azure Web App und auf Configure klicken

  1. Dabei wird nun ein neues File azure-webapps-php.yml im richtigen Unterordner des Git Repository erstellt. Folgende Variablen müssen im YAML File gesetzt werden:

    • AZURE_WEBAPP_NAME = Applikationsname -> z.B. teko-github-actions-prod-switzerlandnorth-001
    • PHP_VERSION = PHP Version welche verwendet wird -> z.B. '8.0'

    Sobald die Änderungen vollzogen wurden, kann das neue YAML File für GitHub Actions oben rechts mit Start commit direkt in master Branch commited & gepushed werden.

  1. Unter Settings -> Secret -> Actions muss ein geheimer Schlüssel mit dem Namen AZURE_WEBAPP_PUBLISH_PROFILE erstellt werden. Dabei wird der Inhalt des Publish Profile welches auf dem Azure App Service heruntergeladen werden kann, als geheimer Schlüssel/Variable gespeichert.

  1. Nun wird bei jedem Commit in master Branch ein automatisierter Build & Deployment zu Microsoft Azure App Service ausgelöst.

Automatisiertes Release
  1. Der dazugehörige GitHub Action Workflow für das automatisierte Erstellen eines Releases befindet sich hier: release.yml

Wichtig: Es wird nur ein Release erzeugt, sobald ein Tag gepushed wird.

Anwendung

Go and Enjoy! 😄

Credits

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.