-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (80 loc) · 2.93 KB
/
publish.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
87
88
89
90
91
92
93
94
95
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
env:
DOCKER_REGISTRY: ghcr.io
jobs:
publish-docker-image:
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker login
uses: docker/login-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.DOCKER_REGISTRY }}
- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 7
- uses: olegtarasov/[email protected]
id: tag-name
- name: Build apollo with sha
uses: docker/build-push-action@v3
with:
push: true
context: apollo
tags: |
${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/apollo:sha-${{ steps.short-sha.outputs.sha }}
${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/apollo:staging
- name: Build apollo with tag
uses: docker/build-push-action@v3
if: startsWith(github.ref, 'refs/tags/v')
with:
push: true
context: apollo
tags: |
${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/apollo:${{ steps.tag-name.outputs.tag }}
${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/apollo:latest
- name: Build ponder with sha
uses: docker/build-push-action@v3
with:
push: true
context: ponder/lnv3
tags: |
${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/ponder:sha-${{ steps.short-sha.outputs.sha }}
${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/ponder:staging
- name: Build ponder with tag
uses: docker/build-push-action@v3
if: startsWith(github.ref, 'refs/tags/v')
with:
push: true
context: ponder/lnv3
tags: |
${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/ponder:${{ steps.tag-name.outputs.tag }}
${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/ponder:latest
deploy-railway:
name: Deploy railway
runs-on: ubuntu-latest
needs: [publish-docker-image]
steps:
- uses: actions/checkout@v2
- name: Deploy apollo-prd
uses: fewensa/action-railway-redeploy@main
if: startsWith(github.ref, 'refs/tags/v')
with:
railway_token: ${{ secrets.RAILWAY_TOKEN }}
environment_id: "5ff5ac60-0640-4f67-9ab1-0c96847a1a32"
service_id: "15b7ef1b-90f0-4fae-8404-97a4d790c271"
- name: Deploy apollo-stg
uses: fewensa/action-railway-redeploy@main
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
with:
railway_token: ${{ secrets.RAILWAY_TOKEN }}
environment_id: "97eba9bb-0d0e-43ce-a9c1-5ea78b7891ef"
service_id: "07ce396e-d868-459e-a0f2-5563483d7aba"