diff --git a/.github/workflows/publish_agent.yml b/.github/workflows/publish_agent.yml index 46e776f1..518f6601 100644 --- a/.github/workflows/publish_agent.yml +++ b/.github/workflows/publish_agent.yml @@ -216,74 +216,74 @@ jobs: run: npm run release ### DEPLOY ### - # deploy: - # name: Deploy cloud agent - # environment: ${{ needs.set_env.outputs.ENV }} - # env: - # AGENT_VERSION: ${{ inputs.agent_version }} - # needs: [set_env, build] - - # runs-on: ubuntu-latest - - # steps: - # - name: Checkout code - # uses: actions/checkout@v4 - - # - name: Setup Node.js ${{ matrix.node-version }} - # uses: actions/setup-node@v4 - # with: - # node-version: ${{ matrix.node-version }} - - # - name: Install packages - # run: npm install --only dev - - # - name: Configure AWS credentials - # uses: aws-actions/configure-aws-credentials@v4 - # with: - # role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/katalon-github-oidc-federation - # role-session-name: github-actions - # aws-region: ${{ vars.AWS_REGION }} - # mask-aws-account-id: 'no' - - # - name: Download artifacts - # uses: actions/download-artifact@v4 - # with: - # path: . - - # - name: Add execute permission to downloaded artifacts - # run: chmod +x katalon-agent-linux-*/* katalon-agent-macos-*/* - - - # - name: Deploy to s3 prod - # if: ${{ needs.set_env.outputs.ENV == 'prod' }} - # run: | - # ls -laR - # aws s3 cp katalon-agent-linux-x64-*/cli-linux-x64 s3://${{ secrets.AWS_S3_BUCKET }}/katalon-agent/$AGENT_VERSION/cli-linux-x64 - - # commit: - # runs-on: ubuntu-latest - # needs: [set_env, build, deploy, release] - # name: Commit Code - # env: - # AGENT_VERSION: ${{ inputs.agent_version }} - # environment: ${{ needs.set_env.outputs.ENV }} - # steps: - # - uses: actions/checkout@v4 - # with: - # token: ${{ secrets.GH_TOKEN }} - - # - name: Set BUILD_VERSION environment variable - # run: echo "BUILD_VERSION=$(node -p "require('./package').version")" >> $GITHUB_ENV - - # - name: Change Package.json version for release - # run: sed -i "s/$BUILD_VERSION/$AGENT_VERSION/g" package.json + deploy: + name: Deploy cloud agent + environment: ${{ needs.set_env.outputs.ENV }} + env: + AGENT_VERSION: ${{ inputs.agent_version }} + needs: [set_env, build] + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install packages + run: npm install --only dev + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/katalon-github-oidc-federation + role-session-name: github-actions + aws-region: ${{ vars.AWS_REGION }} + mask-aws-account-id: 'no' + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: . + + - name: Add execute permission to downloaded artifacts + run: chmod +x katalon-agent-linux-*/* katalon-agent-macos-*/* + + + - name: Deploy to s3 prod + if: ${{ needs.set_env.outputs.ENV == 'prod' }} + run: | + ls -laR + aws s3 cp katalon-agent-linux-x64-*/cli-linux-x64 s3://${{ secrets.AWS_S3_BUCKET }}/katalon-agent/$AGENT_VERSION/cli-linux-x64 + + commit: + runs-on: ubuntu-latest + needs: [set_env, build, deploy, release] + name: Commit Code + env: + AGENT_VERSION: ${{ inputs.agent_version }} + environment: ${{ needs.set_env.outputs.ENV }} + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} + + - name: Set BUILD_VERSION environment variable + run: echo "BUILD_VERSION=$(node -p "require('./package').version")" >> $GITHUB_ENV + + - name: Change Package.json version for release + run: sed -i "s/$BUILD_VERSION/$AGENT_VERSION/g" package.json - # ### Commit code - # - name: Deploy to GitOps - # uses: stefanzweifel/git-auto-commit-action@v5 - # with: - # commit_message: Update version to ${{ env.AGENT_VERSION }} - # # Optional commit user and author settings - # commit_user_name: github-cloudops-bot # defaults to "github-actions[bot]" - # commit_user_email: github-cloudops-bot@katalon.com # defaults to "41898282+github-actions[bot]@users.noreply.github.com" - # commit_author: Author # defaults to author of the commit that triggered the run + ### Commit code + - name: Deploy to GitOps + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Update version to ${{ env.AGENT_VERSION }} + # Optional commit user and author settings + commit_user_name: github-cloudops-bot # defaults to "github-actions[bot]" + commit_user_email: github-cloudops-bot@katalon.com # defaults to "41898282+github-actions[bot]@users.noreply.github.com" + commit_author: Author # defaults to author of the commit that triggered the run