-
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (76 loc) · 3.05 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
87
88
89
90
91
92
93
name: Releases
on:
push:
tags:
- .*
jobs:
prod:
name: Build production image
runs-on: ubuntu-latest
steps:
- name: Wait for tests
uses: fountainhead/action-wait-for-check@v1.1.0
id: wait-for-tests
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: Run tests
ref: ${{ github.sha }}
intervalSeconds: 60
timeoutSeconds: 3600
- name: Fail the Build
uses: cutenode/action-always-fail@v1
if: steps.wait-for-tests.outputs.conclusion != 'success'
- name: Checkout code
uses: actions/checkout@v4
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4.x
- name: Get cached docker images
uses: satackey/action-docker-layer-caching@v0.0.11
continue-on-error: true
with:
key: docker-${{ runner.os }}-base-${{ hashFiles('**/Dockerfile.base') }}-prod-${{ hashFiles('**/Dockerfile.prod') }}-mix-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }}
restore-keys: |
docker-${{ runner.os }}-base-${{ hashFiles('**/Dockerfile.base') }}-prod-${{ hashFiles('**/Dockerfile.prod') }}-mix-${{ hashFiles('**/mix.lock') }}
docker-${{ runner.os }}-base-${{ hashFiles('**/Dockerfile.base') }}-prod-${{ hashFiles('**/Dockerfile.prod') }}-
docker-${{ runner.os }}-base-${{ hashFiles('**/Dockerfile.base') }}-
- name: Login to DockerHub
uses: nick-invision/retry@v3
with:
timeout_seconds: 15
max_attempts: 3
retry_on: any
command: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p "${{ secrets.DOCKERHUB_TOKEN }}"
- name: Build base image
run: docker build -t dolfinus/arkenston-backend:base --compress -f ${{ github.workspace }}/Dockerfile.base ${{ github.workspace }}
- name: Build production image
run: docker build -t dolfinus/arkenston-backend:${{ env.GITHUB_REF_SLUG }} --compress -f ${{ github.workspace }}/Dockerfile.prod ${{ github.workspace }}
- name: Push production image
run: |
docker push dolfinus/arkenston-backend:${{ env.GITHUB_REF_SLUG }}
docker tag dolfinus/arkenston-backend:${{ env.GITHUB_REF_SLUG }} dolfinus/arkenston-backend:latest
docker push dolfinus/arkenston-backend:latest
- name: Logout from DockerHub
run: docker logout
schema:
name: Upload GraphQL schema
runs-on: ubuntu-latest
needs: [prod]
steps:
- name: Download artifacts
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: test.yml
workflow_conclusion: success
name: graphql-schema
path: ./graphql/
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.PERSONAL_TOKEN }}
draft: false
prerelease: false
files: |
graphql/schema.json
graphql/schema.graphql