From fa02707e23cf211a655f1867cd8b0cf04f45db97 Mon Sep 17 00:00:00 2001 From: spencershepard Date: Thu, 29 Dec 2022 12:27:37 -0800 Subject: [PATCH] create workflow Create main.yml upload_to_updater Update upload_to_updater.yml Update upload_to_updater.yml Update main.yml Delete python-app.yml Delete upload_to_updater.yml Update main.yml Update main.yml Update main.yml Update main.yml Update main.yml Update main.yml --- .github/workflows/main.yml | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..8aaec85 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,77 @@ +name: CI + +on: + pull_request: + types: + - closed + +jobs: + if_merged: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - run: | + echo The PR was merged + + deploy: + runs-on: ubuntu-latest # windows-latest | macos-latest + name: Deploy to updater if files changed + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. + + - name: Get monitored changed files + id: changed-files + uses: tj-actions/changed-files@v35 + with: + json: "true" + files_from_source_file: .change-monitored + + - name: List all changed files and save to env + run: | + echo "changed_files=${{ steps.changed-files.outputs.all_changed_files }}" >> $GITHUB_ENV + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + echo "$file was changed" + done + + - name: Test env vars + run: | + echo "${{env.changed_files}}" + + - name: Set up Python 3.10 + if: steps.changed-files.outputs.any_changed == 'true' + uses: actions/setup-python@v3 + with: + python-version: "3.10" + + - name: Install dependencies + if: steps.changed-files.outputs.any_changed == 'true' + run: | + python -m pip install --upgrade pip + pip install PyYAML + + - name: Run release_script.py + if: steps.changed-files.outputs.any_changed == 'true' + env: + FTP_SERVER: ${{ secrets.FTP_SERVER }} + FTP_USERNAME: ${{ secrets.FTP_USERNAME }} + FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} + run: | + python release_script.py + + + - name: FTP-Deploy + if: steps.changed-files.outputs.any_changed == 'true' + uses: actions/checkout@v2.1.0 + with: + fetch-depth: 2 + + - name: FTP-Deploy-Action + if: steps.changed-files.outputs.any_changed == 'true' + uses: SamKirkland/FTP-Deploy-Action@4.3.3 + with: + server: ${{ secrets.FTP_SERVER }} + username: ${{ secrets.FTP_USERNAME }} + password: ${{ secrets.FTP_PASSWORD }} + server-dir: Updates/continuous/