From 5f19756ff358bb78dde0636c5d62166630cf9bf8 Mon Sep 17 00:00:00 2001 From: Peter W <34256109+pww217@users.noreply.github.com> Date: Tue, 10 May 2022 12:27:06 -0500 Subject: [PATCH] fix ci issues (#312) * test ci * sync fixes, ignore symlink * remove symlink * undo trigger tests * only deploy latest on merge, not PR * quotes to single --- .github/workflows/build-alpha.yml | 5 +++-- .github/workflows/build-latest.yml | 11 ++++++++--- .github/workflows/sync-examples.yml | 8 ++++++-- pyscriptjs/examples/toga/static/pyscript | 1 - 4 files changed, 17 insertions(+), 8 deletions(-) delete mode 120000 pyscriptjs/examples/toga/static/pyscript diff --git a/.github/workflows/build-alpha.yml b/.github/workflows/build-alpha.yml index aa9113a6..81ad5024 100644 --- a/.github/workflows/build-alpha.yml +++ b/.github/workflows/build-alpha.yml @@ -16,7 +16,7 @@ jobs: id-token: write defaults: run: - working-directory: ./pyscriptjs + working-directory: pyscriptjs steps: - name: Checkout @@ -43,6 +43,7 @@ jobs: - name: Build pyscript run: | npm run build + # Deploy to S3 - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1.6.1 @@ -50,4 +51,4 @@ jobs: aws-region: ${{secrets.AWS_REGION}} role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} - name: Sync to S3 - run: aws s3 sync . s3://pyscript-static/alpha/ # What artifacts exactly need to be copied? + run: aws s3 sync --quiet ./examples/build/ s3://pyscript-static/alpha/ diff --git a/.github/workflows/build-latest.yml b/.github/workflows/build-latest.yml index fb19705d..7bbaf15e 100644 --- a/.github/workflows/build-latest.yml +++ b/.github/workflows/build-latest.yml @@ -9,9 +9,11 @@ on: - .github/workflows/build-latest.yml # Test that workflow works when changed pull_request: # Run on any PR that modifies files in pyscriptjs/ + branches: + - main paths: - pyscriptjs/** - - .github/workflows/** + - .github/workflows/build-latest.yml # Test that workflow works when changed jobs: build: @@ -21,7 +23,7 @@ jobs: id-token: write defaults: run: - working-directory: ./pyscriptjs + working-directory: pyscriptjs steps: - name: Checkout @@ -48,11 +50,14 @@ jobs: - name: Build pyscript run: | npm run build + # Deploy to S3 - name: Configure AWS credentials + if: github.ref == 'refs/heads/main' # Only deploy on merge into main uses: aws-actions/configure-aws-credentials@v1.6.1 with: aws-region: ${{secrets.AWS_REGION}} role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} - name: Sync to S3 - run: aws s3 sync . s3://pyscript-static/unstable/ # What artifacts exactly need to be copied? + if: github.ref == 'refs/heads/main' + run: aws s3 sync --quiet ./examples/build/ s3://pyscript-static/unstable diff --git a/.github/workflows/sync-examples.yml b/.github/workflows/sync-examples.yml index 980f0b60..a9619b63 100644 --- a/.github/workflows/sync-examples.yml +++ b/.github/workflows/sync-examples.yml @@ -16,14 +16,18 @@ jobs: id-token: write defaults: run: - working-directory: ./pyscriptjs/examples + working-directory: pyscriptjs/examples steps: + # Deploy to S3 + - name: Checkout + uses: actions/checkout@v3 - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1.6.1 with: aws-region: ${{secrets.AWS_REGION}} role-to-assume: ${{ secrets.AWS_OIDC_RUNNER_ROLE }} - name: Sync to S3 - run: aws s3 sync . s3://pyscript-static/examples/ + # Sync outdated or new files, delete ones no longer in source + run: aws s3 sync --quiet --delete . s3://pyscript-static/examples/ # Sync directory, delete what is not in source diff --git a/pyscriptjs/examples/toga/static/pyscript b/pyscriptjs/examples/toga/static/pyscript deleted file mode 120000 index 8fdb6a20..00000000 --- a/pyscriptjs/examples/toga/static/pyscript +++ /dev/null @@ -1 +0,0 @@ -../../build \ No newline at end of file