Skip to content

Commit

Permalink
ci: add unfinished publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nhedger committed Nov 7, 2023
1 parent f814d43 commit 8ab4b2c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ name: Package

on:
workflow_call:
inputs:
nightly:
type: boolean
default: false
required: false
description: 'Whether to publish a nightly build'

jobs:
package:
Expand All @@ -21,6 +27,34 @@ jobs:
- name: Setup
uses: ./.github/actions/setup

- name: Replace name in package.json
run: jq '.name = "biome"' package.json > package.json

- name: Replace displayName in package.json
run: jq '.displayName = "Biome"' package.json > package.json

- name: Retrieve version from package.json
id: packageJsonVersion
run: echo "version=$(jq -r '.version' package.json)"

- name: Parse version
id: version
uses: [email protected]
with:
version: ${{ steps.packageJsonVersion.outputs.version }}

- name: Get date
if: ${{ github.event.inputs.nightly }}
id: date
run: echo "date=$(date +'%Y%m%d')" >> "$GITHUB_OUTPUT"

- name: Build version string
id: version-string
run: echo "version=${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ github.event.inputs.nightly && steps.date.outputs.date || steps.version.outputs.patch }}" >> $GITHUB_OUPUT

- name: Replace version in package.json
run: jq --arg version "${{ steps.version-string.outputs.version }}" '.version = $version' package.json > package.json

- name: Package the extension
run: pnpm exec vsce package -o biome.vsix

Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
nightly:
type: boolean
default: true
required: false
description: 'Whether to publish a nightly build'

jobs:
build:
name: Build
uses: ./.github/workflows/_build.yaml
package:
name: Package
needs: [build]
uses: ./.github/workflows/_package.yaml
with:
# If the workflow was triggered by a schedule event, or the nightly
# input is true, package a nightly build
nightly: ${{ github.event.inputs.nightly || github.event_name == 'schedule' }}

0 comments on commit 8ab4b2c

Please sign in to comment.