Skip to content

Commit

Permalink
Implement release CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin McDonnell committed Mar 18, 2022
1 parent 38cc89d commit 9004904
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 1 deletion.
81 changes: 81 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# .github/release.yml

name: Release
on:
push:
branches:
- "master"
- "ci"
paths:
- package.json

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true

- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 16

- name: Install deps and build
run: |
yarn install
yarn build
- id: publish
name: Publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
dry-run: true

- name: If Publish
if: steps.publish.outputs.type != 'none'
run: |
echo "Published ${{ steps.publish.outputs.type }} version: ${{ steps.publish.outputs.version }}"
- name: If Version Unchanged
if: steps.publish.outputs.type == 'none'
run: |
echo "Version in package.json has not changed. Skipping."
- name: Write Changelog Config
run: |
echo '{"categories": [], "template": "## Commits:\n\n${{ '${{UNCATEGORIZED}}' }}", "pr_template": ${{ '"- ${{MERGE_SHA}} ${{TITLE}}"' }} }' > changelog_config.json
cat changelog_config.json
- name: Changelog Vars
run: |
echo "last_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "curr_commit=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v2.9.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
fromTag: "${{ env.last_tag }}"
toTag: ${{ github.ref }}
commitMode: true
configuration: changelog_config.json

- name: Create Release
if: steps.publish.outputs.type != 'none'
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.publish.outputs.version }}
release_name: v${{ steps.publish.outputs.version }}
commitish: ${{ github.ref }}
body: ${{steps.github_release.outputs.changelog}}
draft: true
prerelease: false
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zod",
"version": "3.14.1",
"version": "3.14.2",
"description": "TypeScript-first schema declaration and validation library with static type inference",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down

0 comments on commit 9004904

Please sign in to comment.