Deploy Platform workflows #14
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: Deploy Platform workflows | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to deploy' | |
required: true | |
type: string | |
default: 'v3.800.0' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Platform workflows | |
repoName: [vc-platform] | |
env: | |
DEPLOY_REPO: ${{ github.repository_owner }}/${{ matrix.repoName }} | |
TEMPLATE_REPO_FOLDER: 'main' | |
TEMPLATES_LIST: 'release.yml publish-nugets.yml platform-release-hotfix.yml platform-ci.yml' | |
WORKING_DIR: ${{ github.workspace }} | |
steps: | |
- name: Checkout .github | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.version }} | |
path: ${{ env.TEMPLATE_REPO_FOLDER }} | |
- name: Checkout ${{ env.DEPLOY_REPO }} | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ env.DEPLOY_REPO }} | |
path: ${{ matrix.repoName }} | |
token: ${{ secrets.REPO_TOKEN }} | |
- name: Copy workflows | |
working-directory: ${{ env.WORKING_DIR }}/${{ env.TEMPLATE_REPO_FOLDER }}/workflow-templates | |
env: | |
DEST_FOLDER: '${{ env.WORKING_DIR }}/${{ matrix.repoName }}/.github/workflows/' | |
run: | | |
cp ${{ env.TEMPLATES_LIST }} ${{ env.DEST_FOLDER }} | |
- name: Setup Git Credentials | |
uses: VirtoCommerce/vc-github-actions/setup-git-credentials-github@master | |
with: | |
githubToken: ${{ secrets.REPO_TOKEN }} | |
- name: Commit changes to ${{ env.DEPLOY_REPO }} | |
working-directory: ${{ matrix.repoName }} | |
run: | | |
git add . | |
git commit -m "ci: Auto update Github Action workflows" | |
git push |