forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
73 lines (63 loc) · 2.5 KB
/
action.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: 'Initial Deploy Action'
description: >
🪂 Initial action to deploy
branding:
icon: 'command'
color: 'red'
inputs:
id:
description: 'The matrix id'
required: true
actor:
description: 'The deploy actor'
required: true
token:
description: 'The deploy token'
required: true
credentials:
description: 'The gcloud credentials'
required: true
action_path:
description: 'Path to the requirements file'
required: true
hub_username:
description: Username for Docker Hub
default: ${{ github.actor }}
required: true
hub_password:
description: Docker Hub authentication token
required: true
hub_token:
description: Docker Hub authentication token
required: true
runs:
using: composite
steps:
- name: 💎 Get the latest commit message
id: commit
shell: bash
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global core.autocrlf false
git config --global --add safe.directory "${{ github.workspace }}"
git config --global credential.helper store
echo "https://${{ github.actor }}:${{ inputs.token }}@github.com" > ~/.git-credentials
echo 'TARGET_REPO="https://${{ github.actor }}:${{ inputs.token }}@github.com/${TARGET_REPOSITORY}.git"' >> ${GITHUB_ENV}
echo 'REMOTE_REPO="https://${{ github.actor }}:${{ inputs.token }}@github.com/${{ github.repository }}.git"' >> ${GITHUB_ENV}
LATEST_COMMIT=$(curl -s "https://api.github.com/users/eq19/events/public" | jq ".[0].payload.commits[0].message")
if [[ -z "$LATEST_COMMIT" ]] || [[ "$LATEST_COMMIT" == null ]]; then echo 'LATEST_COMMIT="update by workspace"' >> ${GITHUB_ENV}; else echo 'LATEST_COMMIT='$LATEST_COMMIT >> ${GITHUB_ENV}; fi
- name: 💎 Update workflow conveniently
if: runner.os == 'Linux'
id: update
shell: bash
run: |
cd "${{ github.workspace }}" && rm -rf .github
cp -r /home/runner/work/_actions/eq19/eq19/v1/.github . && chown -R "$(whoami)" .github
git remote set-url origin ${{ env.REMOTE_REPO }}
git add . && git commit -m ${{ env.LATEST_COMMIT }} && git push
if [ $? -eq 0 ]; then
#git clone --single-branch -b gh-pages ${{ env.REMOTE_REPO }} gh-pages && cd gh-pages
#git add . && git commit --allow-empty -m ${{ env.LATEST_COMMIT }} && git push
exit 1
fi