Skip to content

Commit

Permalink
ci: Add pre release job (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
harrydowning authored Aug 29, 2024
1 parent fd1c21d commit 42d1c5e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 14 deletions.
14 changes: 14 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: setup

runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: "18"
- run: npm i
shell: bash
- run: npm run build
shell: bash
- run: echo "VERSION=$(node -p "require('./package.json').version")" >> "$GITHUB_ENV"
shell: bash
42 changes: 29 additions & 13 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,53 @@
name: pipeline

on: [push]
on:
push:
branches:
- master
pull_request:

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
- run: npm i
- uses: ./.github/actions/setup
- run: npm run generate
- run: "[[ -z $(git status --porcelain) ]]"
- run: npm run type
- run: npm run lint
- run: npm run format
release:
release-check:
runs-on: ubuntu-latest
needs: check
if: github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[release]')
if: github.ref == 'refs/heads/master' && github.repository_owner == 'harrydowning'
steps:
- run: true
release:
runs-on: ubuntu-latest
needs: release-check
if: contains(github.event.head_commit.message, '[release]') && !contains(github.event.head_commit.message, '[pre-release]')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
- run: npm i
- run: npm run build
- uses: ./.github/actions/setup
- run: npx vsce package
- run: echo "VERSION=$(node -p "require('./package.json').version")" >> "$GITHUB_ENV"
- run: gh release create v$VERSION --generate-notes yaml-embedded-languages-$VERSION.vsix
env:
GH_TOKEN: ${{ github.token }}
- run: npx vsce publish
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
pre-release:
runs-on: ubuntu-latest
needs: release-check
if: contains(github.event.head_commit.message, '[pre-release]') && !contains(github.event.head_commit.message, '[release]')
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: npx vsce package --pre-release
- run: gh release create v$VERSION --prerelease --generate-notes yaml-embedded-languages-$VERSION.vsix
env:
GH_TOKEN: ${{ github.token }}
- run: npx vsce publish --pre-release
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ Thank you for taking an interest in contributing to this project. All contributi

- Implement changes, noting that `package.json` is partially generated and `syntaxes` is fully generated so relevant changes to these should be made in `src`
- Run `npm run generate` to update `package.json` and `syntaxes`
- Run `npm run build` to update `dist/extension.js`
- Use F5 within VS Code to test the extension

## Release Workflow

- Update `version` in `package.json` and run `npm i` to update `package-lock.json`
- Update `CHANGELOG.md`
- Update `CHANGELOG.md` (ensure version links are set)
- Merge to master with `[release]` in the commit message

0 comments on commit 42d1c5e

Please sign in to comment.