Sync to Azure #1024
This file contains hidden or 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: Sync to Azure | |
| permissions: | |
| contents: read | |
| on: | |
| workflow_run: | |
| workflows: ["Release"] | |
| types: | |
| - completed | |
| workflow_dispatch: | |
| jobs: | |
| check-env: | |
| if: ${{ github.event.workflow_run.head_branch == 'main' }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| azure-key: ${{ steps.azure-key.outputs.defined }} | |
| steps: | |
| - id: azure-key | |
| env: | |
| AZURE_KEY: ${{ secrets.AZURE_REMOTE_URL }} | |
| if: "${{ env.AZURE_KEY != '' }}" | |
| run: echo "defined=true" >> $GITHUB_OUTPUT | |
| sync: | |
| name: Sync to solid-design-system | |
| needs: check-env | |
| if: needs.check-env.outputs.azure-key == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract branch name | |
| shell: bash | |
| run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT | |
| id: extract_branch_name | |
| - name: Git sync | |
| id: branch | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git fetch origin --unshallow | |
| git config pull.ff only | |
| git remote add --mirror=fetch azure ${{ secrets.AZURE_REMOTE_URL }} | |
| if [[ $(git ls-remote --heads azure ${{ steps.extract_branch_name.outputs.branch }} | wc -l) == "1" ]]; then | |
| echo found | |
| git pull azure ${{ steps.extract_branch_name.outputs.branch }} | |
| git pull -X theirs --allow-unrelated-histories | |
| fi | |
| git push azure --all | |
| git push azure --tags |