Merge pull request #19 from mulesoft-anypoint/dev #21
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: Anypoint Clients Generator Pipeline | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push | |
push: | |
branches: | |
- master | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
generate_code: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
env: | |
CLIENT_GO_REPO: https://github.com/mulesoft-anypoint/anypoint-client-go.git | |
CLIENT_GO_BRANCH: dev | |
#should be the base64 of base64(x-access-token:<accessToken>). more info here https://milangatyas.com/Blog/Detail/11/github-git-repository-authentication-for-auto | |
GIT_AUTH_HEADER_B64: ${{ secrets.GIT_AUTH_HEADER_B64 }} | |
GIT_PIPELINE_USER_EMAIL: [email protected] | |
GIT_PIPELINE_USER_NAME: pipeline-anypoint-clients-generator | |
APP_NAME: anypoint-client-generator | |
COMMIT_MSG: Generates modules from pipeline. | |
steps: | |
- name: Set Up JDK 1.8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
- name: Copy anypoint-client-generator project | |
run: | | |
git config --global http.version HTTP/1.1 | |
git config --global user.email ${{env.GIT_PIPELINE_USER_EMAIL}} | |
git config --global user.name ${{env.GIT_PIPELINE_USER_NAME}} | |
export GENERATOR_FOLDER=`pwd` | |
export GO_CLIENT_FOLDER=`pwd`/dist/${{env.APP_NAME}} | |
export ANYPOINT_GENERATOR_GO_DEST="$GO_CLIENT_FOLDER" | |
npm install | |
git -c http.extraheader="AUTHORIZATION: basic ${{env.GIT_AUTH_HEADER_B64}}" clone --branch ${{env.CLIENT_GO_BRANCH}} ${{env.CLIENT_GO_REPO}} $GO_CLIENT_FOLDER | |
npx openapi-generator-cli generate | |
cd $GO_CLIENT_FOLDER | |
git add . | |
git commit -am "${{env.COMMIT_MSG}}" | |
git -c http.extraheader="AUTHORIZATION: basic ${{env.GIT_AUTH_HEADER_B64}}" push | |