-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (66 loc) · 2.8 KB
/
deploy.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Deploy
on:
push:
branches:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
bump-version:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@main
with:
ref: ${{ github.ref }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "camparibot"
git config --global push.followTags true
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: make install-deps
- name: Bump Version
id: bump-version
run: make bump-version
env:
IMAGE_NAME: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
CAMPARIBOT_TOKEN: ${{ secrets.CAMPARIBOT_TOKEN }}
- name: Create check run
id: create-check-run
run: |
CHECK_RUN_ID=`curl -X POST https://api.github.com/repos/${{ github.repository }}/check-runs \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept:application/vnd.github.antiope-preview+json" \
-d "{\"name\": \"Aporia / deploy (push)\", \"head_sha\": \"${{ steps.bump-version.outputs.bumped_version_commit_hash }}\", \"status\": \"in_progress\", \"details_url\": \"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\", \"output\": {\"title\": \"Versioned Commit\", \"summary\": \"This is a versioned commit. To see the full GitHub Action, [click here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).\"}}" \
| jq .id`;
echo "::set-output name=check_run_id::$CHECK_RUN_ID";
- name: Cache skaffold image builds & config
id: cache-skaffold
uses: actions/cache@v2
with:
path: ~/.skaffold/
key: fixed-${{ github.sha }}
restore-keys: |
fixed-${{ github.sha }}
fixed-
- name: Build
run: make build
env:
NEW_VERSION: ${{ steps.bump-version.outputs.new-version }}
CAMPARIBOT_TOKEN: ${{ secrets.CAMPARIBOT_TOKEN }}
- name: Update check run to success
run: |
curl -X PATCH https://api.github.com/repos/${{ github.repository }}/check-runs/${{ steps.create-check-run.outputs.check_run_id }} \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept:application/vnd.github.antiope-preview+json" \
-d "{\"status\": \"completed\", \"conclusion\": \"success\"}";