-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (48 loc) · 1.51 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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 }}"}}'