Repository navigation
73 lines (65 loc) · 1.82 KB
/
Copy pathremove.yml
File metadata and controls
73 lines (65 loc) · 1.82 KB
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: Remove Assets from Index
concurrency:
group: index
cancel-in-progress: false
on:
workflow_dispatch:
inputs:
project:
type: string
description: project name
files:
type: string
description: asset names
index-branch:
type: string
description: index branch
required: false
default: idx-pages
republish:
type: boolean
description: whether republish the site or not
required: false
default: true
jobs:
add:
name: Remove URLs from Index
runs-on: ubuntu-latest
permissions:
contents: write
env:
idx-checkout-path: index
steps:
- name: checkout index branch
uses: actions/checkout@v3
with:
path: ${{ env.idx-checkout-path }}
ref: ${{ inputs.index-branch }}
- name: update simple index
env:
proj: ${{ inputs.project }}
run: |
cd ${{ env.idx-checkout-path }}
proj=$(echo ${proj} | tr "\-_." "-" | tr -s "-" | tr "A-Z" "a-z")
proj_html="${proj}/index.html"
if [ ! -f $proj_html ]; then exit; fi
for file in ${{ inputs.files }}; do
sed -i "/>${file}</ d" $proj_html
done;
- name: commit index changes
run: |
cd ${{ env.idx-checkout-path }}
git config --local user.name 'github-actions[bot]'
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "remove assets \`${{ inputs.files }}\`"
git push
publish:
if: ${{ inputs.republish }}
needs: add
name: Republish Index Pages
permissions:
contents: read
pages: write
id-token: write
uses: aioqzone/gh-simple-api/.github/workflows/publish.yml@master