Merge pull request #12068 from hargunkaur286/patch-2 #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |