Update PR CI #30
Workflow file for this run
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
# v3.200.7 | |
name: PR deploy | |
on: | |
pull_request: | |
branches: [ master, dev ] | |
types: [ labeled ] | |
jobs: | |
get-deployment-data: | |
if: ${{ github.event.label.name == 'deploy-qa' }} | |
runs-on: ubuntu-latest | |
env: | |
ARTIFACT_NAME: ${{ github.event.repository.name }} | |
DOCKER_CACHE_KEY: '' | |
DOCKER_TAR: 'image.tar' | |
outputs: | |
dockerShortKey: ${{ steps.cache-key.outputs.dockerShortKey }} | |
dockerFullKey: ${{ steps.cache-key.outputs.dockerFullKey }} | |
packageShortKey: ${{ steps.cache-key.outputs.packageShortKey }} | |
packageFullKey: ${{ steps.cache-key.outputs.packageFullKey }} | |
dockerTar: ${{ env.DOCKER_TAR }} | |
jiraKey: ${{ steps.jiraKey.outputs.qaTaskNumber }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get Artifact Version | |
uses: VirtoCommerce/vc-github-actions/get-image-version@master | |
id: artifactVer | |
- name: Get cache key | |
uses: VirtoCommerce/vc-github-actions/cache-get-key@master | |
id: cache-key | |
with: | |
runnerOs: ${{ runner.os }} | |
artifactName: ${{ env.ARTIFACT_NAME }} | |
- name: Gets Jira key from PR body | |
id: jiraKey | |
uses: VirtoCommerce/vc-github-actions/pr-body-get-link@master | |
with: | |
skipArtifactUrl: 'true' | |
githubToken: ${{ secrets.REPO_TOKEN }} | |
publish: | |
needs: | |
get-deployment-data | |
uses: VirtoCommerce/.github/.github/workflows/[email protected] | |
with: | |
fullKey: ${{ needs.get-deployment-data.outputs.dockerFullKey }} | |
shortKey: '${{ needs.get-deployment-data.outputs.dockerShortKey }}-' | |
dockerTar: ${{ needs.get-deployment-data.outputs.dockerTar }} | |
secrets: | |
envPAT: ${{ secrets.GITHUB_TOKEN }} | |
dockerUser: ${{ secrets.DOCKER_USERNAME }} | |
dockerToken: ${{ secrets.DOCKER_TOKEN }} | |
deploy: | |
needs: | |
[publish, get-deployment-data] | |
uses: VirtoCommerce/.github/.github/workflows/[email protected] | |
with: | |
argoServer: 'argo.govirto.com' | |
artifactUrl: ${{ needs.publish.outputs.imagePath }} | |
matrix: '{"include":[{"envName": "qa", "confPath": ".deployment/storefront-app/argoDeploy.json"}]}' | |
taskNumber: ${{ needs.get-deployment-data.outputs.jiraKey }} | |
forceCommit: false | |
secrets: | |
envPAT: ${{ secrets.REPO_TOKEN }} | |
argoLogin: ${{ secrets.ARGOCD_LOGIN }} | |
argoPassword: ${{ secrets.ARGOCD_PASSWORD }} | |
comment-publish: | |
if: ${{ always() && github.event.label.name == 'deploy-qa' }} | |
needs: | |
publish | |
env: | |
MESSAGE_BODY: ':x: Docker image publish filed.' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set MESSAGE_BODY | |
if: ${{ needs.publish.result == 'success' }} | |
run: | | |
echo "MESSAGE_BODY=:heavy_check_mark: Docker image ${{ needs.publish.outputs.imagePath }} published" >> $GITHUB_ENV | |
- name: Add link to PR | |
if: ${{ needs.publish.result == 'success' }} | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
uses: VirtoCommerce/vc-github-actions/publish-artifact-link@master | |
with: | |
artifactUrl: ${{ needs.publish.outputs.imagePath }} | |
- uses: actions/github-script@v5 | |
if: ${{ !(contains('skipped, cancelled', needs.publish.result )) }} | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '${{ env.MESSAGE_BODY }}' | |
}) | |
comment-deploy: | |
if: ${{ always() && github.event.label.name == 'deploy-qa' }} | |
needs: | |
[ deploy, publish ] | |
runs-on: ubuntu-latest | |
env: | |
MESSAGE_BODY: ':x: QA deployment failed.' | |
steps: | |
- name: Set MESSAGE_BODY | |
if: ${{ needs.deploy.result == 'success' }} | |
run: | | |
echo "MESSAGE_BODY=:heavy_check_mark: Docker image ${{ needs.publish.outputs.imagePath }} deployed to QA" >> $GITHUB_ENV | |
- uses: actions/github-script@v5 | |
if: ${{ !(contains('skipped, cancelled', needs.deploy.result )) }} | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '${{ env.MESSAGE_BODY }}' | |
}) |