Skip to content

Commit

Permalink
chore(ci): publish dev builds in ci (#4095)
Browse files Browse the repository at this point in the history
this commit adds a new job for the purposes of building development
versions of stencil, and deploying it to the npm registry

it uses stencil's new build id and version metadata generation to publish
a version of stencil with that metadata to the npm registry

this commit does _not_ go through the typical `npm run release` scripts.
while that work is planned in the future, there's still much to be done in order
for ci to take advantage of them.
  • Loading branch information
rwaskiewicz committed Mar 10, 2023
1 parent 30cb603 commit 33567aa
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/README.md
Expand Up @@ -39,6 +39,11 @@ This workflow is responsible for building Stencil and validating the resultant a
This workflow is responsible for validating that the code adheres to the Stencil team's formatting configuration before
a pull request is merged.

### Dev Release (`release-dev.yml`)

This workflow initiates a developer build of Stencil from the `main` branch.
It is intended to be manually invoked by a member of the Stencil team.

### Test Analysis (`test-analysis.yml`)

This workflow is responsible for running the Stencil analysis testing suite.
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/actions/publish-npm/action.yml
@@ -0,0 +1,38 @@
name: 'Release'
description: 'Releases Stencil Core'
inputs:
version:
description: 'The type of version to release.'
tag:
description: 'The tag to publish to on NPM.'
token:
description: 'The NPM authentication token required to publish.'
runs:
using: 'composite'
steps:
- name: Checkout Code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

- name: Get Core Dependencies
uses: ./.github/workflows/actions/get-core-dependencies

- name: Download Build Archive
uses: ./.github/workflows/actions/download-archive
with:
name: stencil-core
path: .
filename: stencil-core-build.zip

- name: Set Version
run: npm version --no-git-tag-version ${{ inputs.version }}
shell: bash

- name: Prepare NPM Token
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
shell: bash
env:
NPM_TOKEN: ${{ inputs.token }}

- name: Publish to NPM
run: npm publish --tag ${{ inputs.tag }}
shell: bash
61 changes: 61 additions & 0 deletions .github/workflows/release-dev.yml
@@ -0,0 +1,61 @@
name: 'Stencil Dev Release'

on:
workflow_dispatch:
# Make this a reusable workflow, no value needed
# https://docs.github.com/en/actions/using-workflows/reusing-workflows

jobs:
build_core:
name: Build
uses: ./.github/workflows/build.yml

get-dev-version:
name: Get Dev Build Version
needs: [build_core]
runs-on: ubuntu-20.04
outputs:
dev-version: ${{ steps.get-dev-version.outputs.DEV_VERSION }}
steps:
- name: Checkout Code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

- name: Get Core Dependencies
uses: ./.github/workflows/actions/get-core-dependencies

- name: Download Build Archive
uses: ./.github/workflows/actions/download-archive
with:
name: stencil-core
path: .
filename: stencil-core-build.zip

- name: Get Version
id: get-dev-version
run: |
# A unique string to publish Stencil under
# e.g. "3.0.1-dev.1677185104.7c87e34"
#
# Pull this value from the compiled artifacts
DEV_VERSION=$(./bin/stencil version)
echo "Using version $DEV_VERSION"
# store a key/value pair in GITHUB_OUTPUT
# e.g. "DEV_VERSION=3.0.1-dev.1677185104.7c87e34"
echo "DEV_VERSION=$DEV_VERSION" >> $GITHUB_OUTPUT
shell: bash

release-stencil-dev-build:
name: Publish Dev Build
needs: [get-dev-version, build_core]
runs-on: ubuntu-20.04
steps:
- name: Checkout Code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- uses: ./.github/workflows/actions/publish-npm
with:
tag: dev
version: ${{ needs.get-dev-version.outputs.dev-version }}
token: ${{ secrets.NPM_TOKEN }}

0 comments on commit 33567aa

Please sign in to comment.