This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
Prod #1700
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Prod | |
on: | |
push: | |
branches: | |
- master | |
# The schedule is needed to publish blog posts on certain dates, | |
# since posts with future dates are ignored by Hugo. | |
schedule: | |
- cron: '0 6 * * *' | |
env: | |
OPENSHIFT_API: https://api.cloudscale-lpg-2.appuio.cloud:6443 | |
REGISTRY_URL: registry.cloudscale-lpg-2.appuio.cloud | |
IMG_NAME: nginx | |
IMG_TAG: master | |
NAMESPACE: appuio-website-prod | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
steps: | |
# No checkout needed, docker/build-push-action@v2 does that already | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY_URL }}/${{ env.NAMESPACE }}/${{ env.IMG_NAME }} | |
- name: Docker login | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY_URL }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.OPENSHIFT_TOKEN }} | |
- name: Build image | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
environment: | |
name: production | |
url: https://appuio.ch | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup helmfile | |
uses: mamezou-tech/[email protected] | |
with: | |
helmfile-version: v0.144.0 | |
install-kubectl: false | |
install-helm: false | |
helm-diff-plugin-version: v3.6.0 | |
- name: Authenticate and set context | |
uses: redhat-actions/oc-login@v1 | |
with: | |
openshift_server_url: ${{ env.OPENSHIFT_API }} | |
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} | |
namespace: ${{ env.NAMESPACE }} | |
- name: Deploy app | |
run: helmfile -n ${{ env.NAMESPACE }} -f envs/helmfile.yaml -e production apply --wait | |
env: | |
IMG_TAG: ${{ env.IMG_TAG }} | |
GIT_SHA: ${{ github.sha }} | |
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }} | |
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }} | |
ORIGIN: appuio.ch |