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>
This commit is contained in:
Peter W
2022-06-21 09:42:56 -05:00
committed by GitHub
parent 9274f9ec08
commit f3888df88c
3 changed files with 66 additions and 18 deletions

56
.github/workflows/build-release.yml vendored Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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/