forked from meshery/meshery
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (111 loc) · 4.11 KB
/
build-and-release-edge.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Meshery Build and Releaser (edge)
on:
workflow_dispatch:
push:
branches:
- "master"
paths-ignore:
- "docs/**"
- ".github/**"
- "install/**"
jobs:
update-rest-api-docs:
name: Update REST API Documentation
if: github.repository == 'meshery/meshery'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Check if handlers were modified
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
modified:
- added|modified: "server/handlers/**"
- name: Setup go-swagger
if: steps.changes.outputs.modified == 'true'
uses: minchao/setup-go-swagger@v1
with:
version: v0.30.5
- name: swagger-spec
if: steps.changes.outputs.modified == 'true'
run: |
make swagger-build
- name: swagger-docs
if: steps.changes.outputs.modified == 'true'
run: |
make swagger-docs-build
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: docs
commit_user_name: l5io
commit_user_email: [email protected]
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit_options: "--signoff"
commit_message: "[Docs] Updated Swagger Docs for REST API"
update-graphql-docs:
name: Update GraphQL API Documentation
if: github.repository == 'meshery/meshery'
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Check if schema was modified
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
modified:
- added|modified: 'server/internal/graphql/schema/schema.graphql'
- name: Set up Ruby
if: steps.filter.outputs.modified == 'true'
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true
- name: graphql-docs
if: steps.filter.outputs.modified == 'true'
run: |
cd docs; bundle install; cd ..; \
make graphql-docs-build
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: docs
commit_user_name: l5io
commit_user_email: [email protected]
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit_options: "--signoff"
commit_message: "[Docs] Updated GraphQL API Documentation"
docker-build-push:
name: Docker build and push
if: github.repository == 'meshery/meshery' && github.event_name != 'pull_request' && success()
env:
RELEASE_CHANNEL: "edge"
runs-on: ubuntu-22.04
steps:
- name: Fetch latest tag
run: |
echo "LATEST_TAG=$(curl --silent "https://api.github.com/repos/meshery/meshery/releases" | jq ' .[] | ."tag_name"' | sed -n 1p$'\n' | tr -d '"')" >> $GITHUB_ENV
- name: Check out code
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Docker login
uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker edge build & tag
run: |
DOCKER_BUILDKIT=1 docker build -f install/docker/Dockerfile --no-cache -t ${{ secrets.IMAGE_NAME }}:edge-latest --build-arg TOKEN=${{ secrets.GLOBAL_TOKEN }} --build-arg GIT_COMMITSHA=${GITHUB_SHA::8} --build-arg GIT_VERSION=${{ env.LATEST_TAG }} --build-arg RELEASE_CHANNEL=${RELEASE_CHANNEL} .
docker tag ${{ secrets.IMAGE_NAME }}:edge-latest ${{ secrets.IMAGE_NAME }}:edge-${GITHUB_SHA::8}
docker tag ${{ secrets.IMAGE_NAME }}:edge-latest ${{ secrets.IMAGE_NAME }}:edge-${{ env.LATEST_TAG }}
- name: Docker edge push
run: |
docker push ${{ secrets.IMAGE_NAME }}:edge-latest
docker push ${{ secrets.IMAGE_NAME }}:edge-${GITHUB_SHA::8}
docker push ${{ secrets.IMAGE_NAME }}:edge-${{ env.LATEST_TAG }}