-
Notifications
You must be signed in to change notification settings - Fork 4
48 lines (44 loc) · 1.44 KB
/
sync-to-azure.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Sync to Azure
on:
workflow_run:
workflows: ["Release new version"]
types:
- completed
workflow_dispatch:
jobs:
check-env:
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 "::set-output name=defined::true"
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.1.1
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
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