-
Notifications
You must be signed in to change notification settings - Fork 2
31 lines (30 loc) · 1.14 KB
/
main.yml
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
name: deploy
on:
push:
branches:
- master
- v3
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set variables
id: vars
run: |
echo ::set-output name=docker_image::docker.pkg.github.com/${{ github.repository }}/master:$(git rev-parse --short=7 ${{ github.sha }})
- name: Build docker image
run: |
docker build . --file Dockerfile --tag ${{ steps.vars.outputs.docker_image }}
- name: Login to registry
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com --username ${{ github.actor }} --password-stdin
- name: Push docker image
run: |
docker push ${{ steps.vars.outputs.docker_image }}
- name: Deploy
run: |
jq -n \
--arg msg "$(git log --format=%B -n 1)" \
'{"repository":"${{ github.repository }}","dockerImage":"${{ steps.vars.outputs.docker_image }}","branch":"${{ github.ref }}","commitMessage":$msg}' | \
curl -s --fail -X POST -H 'Content-Type: application/json' -H 'Authorization: Basic ${{ secrets.deployToken }}' -d@- https://galleon.pekle.lv/deploy