forked from meshery/meshery
-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (127 loc) · 4.7 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Meshery Build and Releaser (edge)
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to deploy in the staging environment. If not provided, master branch of the repository will be used."
default: "master"
type: string
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@v4
- name: Check if handlers were modified
uses: dorny/paths-filter@v3
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: Pull changes from remote
run: git pull origin master
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
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@v4
with:
fetch-depth: 1
ref: ${{ inputs.branch }}
- name: Check if schema was modified
uses: dorny/paths-filter@v3
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: Pull changes from remote
run: git pull origin master
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
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@v4
with:
fetch-depth: 1
ref: ${{ inputs.branch }}
- 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 }}
update-staging-playground:
needs:
- docker-build-push
uses: meshery/meshery/.github/workflows/cncf-staging-playground-deploy-meshery.yaml@master
secrets: inherit