-
Notifications
You must be signed in to change notification settings - Fork 375
71 lines (69 loc) · 2.91 KB
/
Copy pathupdate-install-script.yaml
File metadata and controls
71 lines (69 loc) · 2.91 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
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/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout project
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
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@a309ff8b426b58ec0e2a45f0f869d46889d02405 #v6.2.0
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: Generate KICS Bot token
id: kics-bot-token
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 #v3.1.1
with:
client-id: ${{ vars.GH_APP_KICSAPP_CLIENT_ID }}
private-key: ${{ secrets.GH_APP_KICSAPP_PRIVATE_KEY }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v6
with:
title: "chore(install): update install script"
token: ${{ steps.kics-bot-token.outputs.token }}
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