From f3888df88c8c4d4775961923ee86afe634f0d75d Mon Sep 17 00:00:00 2001 From: Peter W <34256109+pww217@users.noreply.github.com> Date: Tue, 21 Jun 2022 09:42:56 -0500 Subject: [PATCH] Release automation (#521) * workflow updates * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * build release * remove if * test on main * update docs release workflow Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/build-release.yml | 56 +++++++++++++++++++ .github/workflows/docs-release.yml | 8 +-- .../{build-alpha.yml => publish-release.yml} | 20 +++---- 3 files changed, 66 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/build-release.yml rename .github/workflows/{build-alpha.yml => publish-release.yml} (78%) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 00000000..be8a0f10 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,56 @@ +name: '[CI] Build Release' + +on: + push: + tags: + - '**' + +env: + MINICONDA_PYTHON_VERSION: py38 + MINICONDA_VERSION: 4.11.0 + +defaults: + run: + working-directory: pyscriptjs + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v3 + + - name: Install node + uses: actions/setup-node@v3 + with: + node-version: 18.x + + - name: Cache node modules + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: setup Miniconda + uses: conda-incubator/setup-miniconda@v2 + + - name: Setup Environment + run: make setup + + - name: Build and Test + run: make test + + - name: Prepare Release + uses: softprops/action-gh-release@v1 + with: + draft: true + prerelease: true + generate_release_notes: true diff --git a/.github/workflows/docs-release.yml b/.github/workflows/docs-release.yml index a007e9bc..84befbdf 100644 --- a/.github/workflows/docs-release.yml +++ b/.github/workflows/docs-release.yml @@ -1,15 +1,11 @@ name: '[Docs] Build Release' on: - # Any time a tag or branch is created - # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#create - create: - paths: - - docs/** + release: + types: [published] jobs: build: - if: startsWith(github.ref, 'refs/tags') # Only if tagged runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/build-alpha.yml b/.github/workflows/publish-release.yml similarity index 78% rename from .github/workflows/build-alpha.yml rename to .github/workflows/publish-release.yml index 30b2501b..5024f015 100644 --- a/.github/workflows/build-alpha.yml +++ b/.github/workflows/publish-release.yml @@ -1,11 +1,8 @@ -name: '[CI] Build Alpha' +name: '[CI] Publish Release' on: - push: - tags: - - '**' # Currently any tag, need to slim down - paths: - - pyscriptjs/** + release: + types: [published] env: MINICONDA_PYTHON_VERSION: py38 @@ -22,7 +19,6 @@ jobs: contents: read id-token: write steps: - - name: Checkout uses: actions/checkout@v3 @@ -53,14 +49,14 @@ jobs: - name: Build and Test run: make test - # Deploy to S3 + # Upload 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 - if: github.ref == 'refs/heads/main' - run: aws s3 sync --quiet ./examples/build/ s3://pyscript.net/alpha/ +# - name: Sync to S3 +# run: | # Overwrite "latest" alpha + versioned subdirectory +# aws s3 sync --quiet ./examples/build/ s3://pyscript.net/alpha/${{ github.ref_name }} +# aws s3 sync --quiet ./examples/build/ s3://pyscript.net/alpha/