Skip to content

Add deploy step to CI #2

Add deploy step to CI

Add deploy step to CI #2

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- id: build_version
run: |
echo "build_version=$(echo ${GITHUB_SHA} | cut -c1-12)" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@v3
with:
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.build_version }},${{ env.REGISTRY }}/${{ github.repository }}:latest
context: "."
file: Dockerfile
push: true
build-args: |
DEPS_FLAGS=--no-dev
deploy:
runs-on: ubuntu-latest
steps:
- id: build_version
run: |
echo "build_version=$(echo ${GITHUB_SHA} | cut -c1-12)" >> $GITHUB_ENV
- name: Trigger deploy
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.OPS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/gi0baro/ops/dispatches \
-d '{"event_type":"deploy_emmett-sh","client_payload":{"build_tag": "${{ env.build_version }}"}}'