mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Create winrepo PR on release
This commit is contained in:
parent
866dbbdebc
commit
8b7d6fdc26
2 changed files with 94 additions and 0 deletions
31
.github/workflows/scripts/update_winrepo.py
vendored
Normal file
31
.github/workflows/scripts/update_winrepo.py
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
import argparse
|
||||
import os
|
||||
|
||||
# Where are we
|
||||
print(os.getcwd())
|
||||
|
||||
arg_parser = argparse.ArgumentParser()
|
||||
arg_parser.add_argument("-f", "--file", help="the winrepo file to edit")
|
||||
arg_parser.add_argument("-v", "--version", help="The version to add")
|
||||
|
||||
args = arg_parser.parse_args()
|
||||
file = args.file
|
||||
version = args.version
|
||||
|
||||
if version.startswith("v"):
|
||||
version = version[1:]
|
||||
|
||||
with open(file) as f:
|
||||
current_contents = f.readlines()
|
||||
|
||||
new_contents = []
|
||||
|
||||
added = False
|
||||
for line in current_contents:
|
||||
new_contents.append(line)
|
||||
if "for version in [" in line and not added:
|
||||
new_contents.append(f" '{version}',\n")
|
||||
added = True
|
||||
|
||||
with open(file, "w") as f:
|
||||
f.writelines(new_contents)
|
63
.github/workflows/update_winrepo.yml.txt
vendored
Normal file
63
.github/workflows/update_winrepo.yml.txt
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
---
|
||||
name: Update Winrepo
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update-winrepo:
|
||||
name: Update Winrepo
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Checkout Salt
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: salt
|
||||
|
||||
- name: Checkout WinRepo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: winrepo
|
||||
repository: twangboy/salt-winrepo-ng
|
||||
|
||||
- name: Set Up Python 3.10
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.10
|
||||
|
||||
- name: Add Version to Minion Definition File
|
||||
working-directory: salt
|
||||
run: |
|
||||
python .github/workflows/scripts/update_winrepo.py \
|
||||
--file ../winrepo/salt-minion.sls \
|
||||
--version ${{ github.ref_name }}
|
||||
|
||||
- name: Commit Changes
|
||||
working-directory: winrepo
|
||||
run: |
|
||||
git status
|
||||
git add .
|
||||
git config user.name 'saltbot-open'
|
||||
git config user.email 'saltbot-open@users.noreply.github.com'
|
||||
git commit -m 'Adding salt minion 3006.1'
|
||||
|
||||
- name: Create Pull Request
|
||||
id: cpr
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
path: winrepo
|
||||
push-to-fork: saltbot-open/salt-winrepo-ng
|
||||
token: ${{ secrets.SALTBOT_OPEN_SALT_WINREPO_NG }}
|
||||
|
||||
# - name: Enable Pull Request Automerge
|
||||
# if: steps.cpr.outputs.pull-request-operation == 'created'
|
||||
# uses: peter-evans/enable-pull-request-automerge@v2
|
||||
# with:
|
||||
# token: ${{ secrets.SALTBOT_OPEN_SALT_WINREPO_NG }}
|
||||
# pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
|
||||
# merge-method: squash
|
Loading…
Add table
Reference in a new issue