-
Notifications
You must be signed in to change notification settings - Fork 321
65 lines (63 loc) · 2.43 KB
/
update-install-script.yaml
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
name: update-install-script
on:
workflow_dispatch:
jobs:
update-install:
name: Update install script
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Godownloader
env:
BASE_URL: https://github.com/goreleaser/godownloader/releases/download
run: |
LATEST_TAG=$(curl --silent "https://api.github.com/repos/goreleaser/godownloader/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
LATEST_VERSION=${LATEST_TAG#v}
FULL_URL="${BASE_URL}/${LATEST_TAG}/godownloader_${LATEST_VERSION}_Linux_x86_64.tar.gz"
mkdir -p .bin
PROJDIR=$(pwd)
cd .bin && wget "${FULL_URL}" \
&& tar xf $(basename "${FULL_URL}") \
&& chmod +x godownloader \
&& rm -vf $(basename "${FULL_URL}") \
&& cd "${PROJDIR}"
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
pip3 install ruamel.yaml
- name: Remove 'brews' from .goreleaser.yaml
id: filter
run: |
#!/usr/bin/env python3
import ruamel.yaml
with open('./docker/.goreleaser.yml', 'r') as file:
file_obj = ruamel.yaml.load(file, Loader=ruamel.yaml.RoundTripLoader)
del file_obj['brews']
file_content = ruamel.yaml.dump(file_obj, Dumper=ruamel.yaml.RoundTripDumper)
print(f"::set-output name=goreleaser::{file_content}", end='')
shell: python3 {0}
- name: Update install.sh
run: ./.bin/godownloader --repo Checkmarx/kics <(echo ${{ steps.outputs.filter.goreleaser }}) > install.sh
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
title: "chore(install): update install script"
token: ${{ secrets.KICS_BOT_PAT }}
delete-branch: true
commit-message: "chore(install): update install script"
branch: feature/kicsbot-update-install-script
base: master
body: |
**Automated Changes**
Updating oneliner godownloader installation script
Triggered by SHA: _${{ github.sha }}_
labels: CI