forked from async-graphql/graphgate
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (120 loc) · 3.95 KB
/
release.yml
File metadata and controls
125 lines (120 loc) · 3.95 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Release
on:
push:
branches:
- release
jobs:
graphgate-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get version
run: echo PACKAGE_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
context: .
tags: |
scott829/graphgate:${{ env.PACKAGE_VERSION }}
scott829/graphgate:latest
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
examples-docker:
runs-on: ubuntu-latest
needs: graphgate-docker
steps:
- name: Checkout
uses: actions/checkout@v2
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push ${{ matrix.package.name }}
uses: docker/build-push-action@v2
with:
push: true
context: .
file: Dockerfile-examples
tags: scott829/graphgate-examples:latest
- name: Deploy to Kubernetes
uses: WyriHaximus/github-action-helm3@v2
with:
kubeconfig: '${{ secrets.K8S_CONFIG }}'
exec: |
helm uninstall -n graphgate graphgate
helm upgrade --create-namespace -i -n graphgate graphgate examples/helm
standalone-demo-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push ${{ matrix.package.name }}
uses: docker/build-push-action@v2
with:
push: true
context: .
file: Dockerfile-standalone-demo
tags: scott829/graphgate-standalone-demo:latest
publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
package:
- name: graphgate-schema
registryName: graphgate-schema
path: crates/schema
- name: graphgate-validation
registryName: graphgate-validation
path: crates/validation
- name: graphgate-planner
registryName: graphgate-planner
path: crates/planner
- name: graphgate-handler
registryName: graphgate-handler
path: crates/handler
- name: graphgate
registryName: graphgate
path: .
steps:
- name: Checkout
uses: actions/checkout@v2
- name: get version
working-directory: ${{ matrix.package.path }}
run: echo PACKAGE_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV
- name: check published version
run: echo PUBLISHED_VERSION=$(cargo search ${{ matrix.package.registryName }} --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -) >> $GITHUB_ENV
- name: cargo login
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
run: cargo login ${{ secrets.CRATES_TOKEN }}
- name: cargo package
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
working-directory: ${{ matrix.package.path }}
run: |
cargo package
echo "We will publish:" $PACKAGE_VERSION
echo "This is current latest:" $PUBLISHED_VERSION
- name: Publish ${{ matrix.package.name }}
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
working-directory: ${{ matrix.package.path }}
run: |
echo "# Cargo Publish"
cargo publish --no-verify