coPilot failure is your only option #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and Release suspendAndDelete script | |
on: [push, pull_request] | |
jobs: | |
test-python: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run suspendAndDelete script | |
env: | |
MATRIX_ROCKS_API_TOKEN: ${{ secrets.MATRIX_ROCKS_API_TOKEN }} | |
MATRIX_ROCKS_SUSPENDBLE_USERIDS: ${{ vars.MATRIX_ROCKS_SUSPENDBLE_USERIDS }} | |
run: | | |
user_id=$(echo "$MATRIX_ROCKS_SUSPENDBLE_USERIDS" | head -n 1) | |
python suspendAndDelete.py --user $user_id --reason "Testing suspension" 2>&1 | tee output.log | |
continue-on-error: true | |
- name: Check for errors in log | |
run: | | |
if grep -i "error" output.log; then | |
echo "Errors found in script output" | |
exit 1 | |
fi | |
test-bash: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Run suspend.sh script | |
env: | |
MATRIX_ROCKS_API_TOKEN: ${{ secrets.MATRIX_ROCKS_API_TOKEN }} | |
MATRIX_ROCKS_SUSPENDBLE_USERIDS: ${{ vars.MATRIX_ROCKS_SUSPENDBLE_USERIDS }} | |
run: | | |
user_id=$(echo "$MATRIX_ROCKS_SUSPENDBLE_USERIDS" | head -n 1) | |
./suspend.sh --user $user_id --reason "Testing suspension" 2>&1 | tee suspend_output.log | |
continue-on-error: true | |
- name: Check for errors in suspend.sh log | |
run: | | |
if grep -i "error" suspend_output.log; then | |
echo "Errors found in script output" | |
exit 1 | |
fi | |
release: | |
needs: [test-python, test-bash] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.12' | |
- name: Get version from suspendAndDelete.py | |
id: get_version | |
run: | | |
version=$(grep -oP 'VERSION = "\K[0-9\.b]+' suspendAndDelete.py) | |
echo "::set-output name=version::$version" | |
- name: Create Release Notes | |
id: create_notes | |
run: | | |
version=${{ steps.get_version.outputs.version }} | |
issue_id=$(echo $version | grep -oP '[0-9]+') | |
release_notes=$(curl -s https://kb.mypdns.org/issue/TBX-$issue_id | grep -oP '<summary>\K[^<]+') | |
echo "::set-output name=release_notes::$release_notes" | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ steps.get_version.outputs.version }} | |
release_name: Release ${{ steps.get_version.outputs.version }} | |
body: ${{ steps.create_notes.outputs.release_notes }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |