From e8c544132e47c109a00cd80e2a7f467a9c1ea728 Mon Sep 17 00:00:00 2001 From: LeoKle Date: Sun, 23 Jun 2024 16:03:15 +0200 Subject: [PATCH] add workflow --- .github/workflows/main.yml | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 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..6ddab5b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,52 @@ +name: databuilder + +on: + push: + branches: + - main + +jobs: + run-workflow-script: + runs-on: ubuntu-latest + + steps: + - name: Checkout main branch + uses: actions/checkout@v2 + with: + ref: main + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.11.4" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run Python script + run: python src/workflow.py + + - name: Archive generated files as artifact + uses: actions/upload-artifact@v2 + with: + name: generated-files + path: ./api + + - name: Checkout production branch + uses: actions/checkout@v2 + with: + ref: production + + - name: Download generated files artifact + uses: actions/download-artifact@v2 + with: + name: generated-files + + - name: Apply changes to production branch + run: | + cp -r ${{ github.workspace }}/generated-files/* ./api + git add . + git commit -m "Add generated files from main branch" + git push origin production