forked from inspirehep/inspirehep
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (75 loc) · 2.11 KB
/
release.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
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
75
76
77
78
79
80
81
82
83
84
85
86
name: Release on prod
on:
workflow_dispatch:
inputs:
ref:
description: 'Commit to deploy on prod'
required: true
tag:
description: 'Tag to release'
required: true
jobs:
merge:
name: Merge to Prod
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: master
- name: Configure git
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Is this reference on master?
run: >
git merge-base
--is-ancestor
${{ github.event.inputs.ref }}
HEAD
- name: Create local branch
if: ${{ success() }}
run: |
git checkout ${{ github.event.inputs.ref }} -b prod
- name: Tag
if: ${{ success() }}
run: |
git tag -a ${{ github.event.inputs.tag }} -m "${MSG}"
- name: Push
if: ${{ success() }}
run: |
git push --force --follow-tags origin prod
push:
name: Push
needs: merge
runs-on: ubuntu-latest
strategy:
matrix:
images:
- inspirehep/hep
- inspirehep/ui
- inspirehep/editor
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: prod
- name: Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Tag and push
uses: ./.github/actions/docker-tag-and-push
with:
image: ${{ matrix.images }}
pull-tag: master-${{ github.event.inputs.ref }}
push-tag: ${{ github.event.inputs.tag }}
- name: Deploy Prod
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.INSPIRE_BOT_TOKEN }}
repository: inspirehep/kubernetes
event-type: deploy
client-payload: '{"environment":"inspire-prod","image":"${{ matrix.images }}","tag":"${{ github.event.inputs.tag }}"}'