Skip to content

make it less abstract #65

make it less abstract

make it less abstract #65

Workflow file for this run

name: Build And Deploy
on:
push:
branches:
- "main"
jobs:
build:
name: Build
runs-on: ubuntu-20.04
outputs:
tag: ${{ steps.prep.outputs.tag }}
steps:
- uses: actions/checkout@v2
- id: prep
run: |
TAG=$(echo $GITHUB_SHA | head -c7)
IMAGE="${{ secrets.REGISTRY_URL }}/abraham-ai/mars-${{ secrets.ENV }}"
echo ::set-output name=tagged_image::${IMAGE}:${TAG}
echo ::set-output name=tag::${TAG}
echo ::set-output name=image::${IMAGE}
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver: docker
- name: Build and Push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.prep.outputs.tagged_image }},${{ steps.prep.outputs.image }}:latest
deploy:
name: Deploy
runs-on: ubuntu-20.04
needs: [build]
if: ${{ always() && (needs.build.result == 'success') }}
steps:
- name: Check out releases repo
uses: actions/checkout@v2
with:
repository: abraham-ai/releases
ref: main
token: ${{ secrets.GENEKOGAN_PAT }}
- id: prep
run: |
IMAGE="${{ secrets.REGISTRY_URL }}/abraham-ai/mars-${{ secrets.ENV }}"
TAG="${{needs.build.outputs.tag}}"
echo ::set-output name=tagged_image::${IMAGE}:${TAG}
echo ::set-output name=tag::${TAG}
echo ::set-output name=image::${IMAGE}
- name: Bump Env
uses: fjogeleit/yaml-update-action@main
with:
valueFile: "apps/mars/runner/values.yaml"
updateFile: true
propertyPath: "$.image"
value: ${{ steps.prep.outputs.tagged_image }}
repository: abraham-ai/releases
branch: main
targetBranch: main
masterBranchName: main
commitChange: true
createPR: false
message: "Update ${{ secrets.ENV }} Image Version to ${{ steps.prep.outputs.tagged_image }}"
token: ${{ secrets.GENEKOGAN_PAT }}
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: "${{ secrets.ENV }} image ${{ steps.prep.outputs.tagged_image }} has been deployed."