diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 207d975e9..b6f33a8bc 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,6 +12,13 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true +env: + DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} + KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }} + CDA_HOST_NAME: tueicda-cda.srv.mwn.de + CDA_USER_NAME: web-user + CDA_TARGET_DIR: /var/www/cda/app/mqtbench/ + jobs: build_wheel: name: Build wheel @@ -77,3 +84,23 @@ jobs: password: ${{ secrets.pypi_password }} skip_existing: true verbose: true + + upload_webserver: + needs: upload_pypi + runs-on: ubuntu-latest + if: github.event_name == 'release' && github.event.action == 'published' + steps: + - name: Create version file + run: | + echo "version = \"$(git describe --tags --always)\"" > mqtbench_version.txt + - name: Setup SSH via the stored Action Secrets + run: | + mkdir -p ~/.ssh + echo "${KNOWN_HOSTS}" >> ~/.ssh/known_hosts + echo "${DEPLOY_KEY}" > ~/.ssh/my_rsync_key + echo "IdentityFile ~/.ssh/my_rsync_key" >> ~/.ssh/config + chmod -R 700 ~/.ssh + - name: Copy version file to the webserver + working-directory: ${{ github.workspace }} + run: | + rsync -avz -e ssh mqtbench_version.txt ${CDA_USER_NAME}@${CDA_HOST_NAME}:${CDA_TARGET_DIR}/mqtbench_version.txt diff --git a/.github/workflows/server_deploy.yml b/.github/workflows/server_deploy.yml deleted file mode 100644 index 93d767885..000000000 --- a/.github/workflows/server_deploy.yml +++ /dev/null @@ -1,42 +0,0 @@ -# Based on: https://zartman.xyz/blog/gh-static-deploy/ -name: Server Deployment -on: - workflow_run: - workflows: ["Deploy to PyPI"] - branches: [main] - types: - - completed - workflow_dispatch: - -env: - DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} - KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }} - CDA_HOST_NAME: tueicda-cda.srv.mwn.de - CDA_USER_NAME: web-user - CDA_TARGET_DIR: /var/www/cda/app/mqtbench/ - CDA_GIT_DIR: .git/ - -jobs: - deploy: - name: Deploy - runs-on: ubuntu-latest - if: github.event_name == 'release' && github.event.action == 'published' || github.event_name == 'workflow_dispatch' - steps: - - name: Checkout git to get the version - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Create version file - run: | - echo "version = \"$(git describe --tags --always)\"" > mqtbench_version.txt - - name: Setup SSH via the stored Action Secrets - run: | - mkdir -p ~/.ssh - echo "${KNOWN_HOSTS}" >> ~/.ssh/known_hosts - echo "${DEPLOY_KEY}" > ~/.ssh/my_rsync_key - echo "IdentityFile ~/.ssh/my_rsync_key" >> ~/.ssh/config - chmod -R 700 ~/.ssh - - name: Copy version file to the webserver - working-directory: ${{ github.workspace }} - run: | - rsync -avz -e ssh mqtbench_version.txt ${CDA_USER_NAME}@${CDA_HOST_NAME}:${CDA_TARGET_DIR}/mqtbench_version.txt