Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release setup update #204

Merged
merged 3 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Create Release PR
on:
workflow_dispatch:
inputs:
version:
type: choice
description: 'version to bump'
required: true
options:
[
'patch',
'minor',
'major',
'prepatch',
'preminor',
'premajor',
'prerelease'
]
default: 'patch'

pull_request:
types: [closed]

jobs:
bump-version-create-pr:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"

- uses: actions/setup-node@v3
with:
node-version: '18'

- name: Bump and create PR
run: |
yarn workspace @dvcorg/gatsby-theme-iterative version --${{ github.event.inputs.version }} --no-git-tag-version
VERSION=$(jq -r '.version' < packages/gatsby-theme-iterative/package.json)
git checkout -b bump/v${VERSION}
git push --set-upstream origin HEAD
gh pr create --title "Bump version to v${VERSION}" --body "Approve me 🤖"
gh pr merge --auto --squash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

create-release:
if: github.event.pull_request.merged && startsWith(github.head_ref, 'bump/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: >
gh release create v$(basename ${{github.head_ref }}) --generate-notes
--draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 5 additions & 39 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,19 @@
name: Publish Package to npmjs
on:
workflow_dispatch:
inputs:
version:
type: choice
description: 'Version to publish'
required: true
options: ['patch', 'minor', 'major', 'pre']
default: 'patch'
dry-run:
type: boolean
description: 'Dry run'
required: false
default: false

release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"

- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
scope: '@dvcorg'
cache: 'yarn'

- name: Install dependencies
run: |
yarn install --frozen-lockfile

- run: |
yarn release:ci ${{ github.event.inputs.version }} --dry-run=${{ github.event.inputs.dry-run }}
if [ "${{ github.event.inputs.dry-run }}" = "false" ]; then
cd ./packages/gatsby-theme-iterative
yarn publish
fi

cd ./packages/gatsby-theme-iterative
yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 0 additions & 27 deletions .release-it.json

This file was deleted.

7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
"serve": "yarn workspace example serve",
"develop": "yarn workspace example develop",
"get-commands": "yarn workspace @dvcorg/gatsby-theme-iterative get-commands",
"prepare": "husky install",
"release": "release-it",
"release:pre": "release-it --preRelease=beta",
"release:ci": "release-it --ci",
"release:dry": "release-it --dry-run"
"prepare": "husky install"
},
"workspaces": [
"packages/*"
Expand All @@ -42,7 +38,6 @@
"husky": "8.0.3",
"lint-staged": "13.2.2",
"prettier": "2.8.8",
"release-it": "^15.10.1",
"stylelint": "15.6.0",
"stylelint-config-standard": "33.0.0"
}
Expand Down
Loading