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

chore: add release workflow #1

Merged
merged 1 commit into from
Jun 8, 2024
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
1 change: 0 additions & 1 deletion .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: '🏗️ '
author: 'PHILLIPS71'

inputs:
COMMAND:
Expand Down
1 change: 0 additions & 1 deletion .github/actions/cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: '🔺️ '
author: 'PHILLIPS71'

runs:
using: 'composite'
Expand Down
1 change: 0 additions & 1 deletion .github/actions/init/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: '💽️ '
author: 'PHILLIPS71'

inputs:
node-version:
Expand Down
1 change: 0 additions & 1 deletion .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: '📦️ '
author: 'PHILLIPS71'

runs:
using: 'composite'
Expand Down
1 change: 0 additions & 1 deletion .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: '🚨️ '
author: 'PHILLIPS71'

runs:
using: 'composite'
Expand Down
50 changes: 42 additions & 8 deletions .github/actions/release/action.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,53 @@
name: '🏷️ '
author: 'PHILLIPS71'

inputs:
GH_TOKEN:
GITHUB_TOKEN:
required: true
NPM_TOKEN:
RELEASE_TYPE:
required: true
RELEASE_IDENTIFIER:
required: false

outputs:
version:
value: ${{ steps.version.outputs.version }}
tag:
value: ${{ steps.version.outputs.tag }}
branch:
value: ${{ steps.branch.outputs.branch }}

runs:
using: 'composite'
steps:
- name: '🏷️ Release'
- name: '🏷️ Increment Release'
id: version
uses: ./
with:
path: VERSION.txt
type: ${{ inputs.RELEASE_TYPE }}
identifier: ${{ inputs.RELEASE_IDENTIFIER }}

- name: '🏷️ Version @giantnodes/next-semver'
shell: bash
run: |
pnpm version ${{ steps.version.outputs.version }} --no-git-tag-version

- name: '🏷️ Configure Git'
shell: bash
env:
GH_TOKEN: ${{ inputs.GH_TOKEN }}
NPM_TOKEN: ${{ inputs.NPM_TOKEN }}
run: |
pnpm run semantic-release
git config --global user.name 'giantnodes-bot'
git config --global user.email '[email protected]'

- name: '🏷️ Tag, Commit & Release'
shell: bash
id: branch
run: |
git checkout -b release/${{ steps.version.outputs.version }}
git commit -anm 'chore(release): v${{ steps.version.outputs.version }}'
git push origin release/${{ steps.version.outputs.version }}

gh release create v${{ steps.version.outputs.version }} ${{ steps.version.outputs.tag == 'latest' && '--latest' || '--prerelease' }} --generate-notes

echo "branch=$(git branch --show-current)" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: '🧪 '
author: 'PHILLIPS71'

inputs:
COMMAND:
Expand Down
1 change: 0 additions & 1 deletion .github/actions/type-check/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: '🦺 '
author: 'PHILLIPS71'

inputs:
COMMAND:
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: '🏷️ Release'

on:
workflow_dispatch:
inputs:
type:
type: choice
description: 'SemVer Increment'
default: 'prerelease'
required: true
options:
- prerelease
- prepatch
- patch
- preminor
- minor
- premajor
- major

jobs:
create-release:
name: '🏷️ Create Release'
runs-on: ubuntu-latest
steps:
- name: '🐙️ Checkout'
uses: actions/checkout@v4

- name: '💽️ Setup'
uses: ./.github/actions/init

- name: '🔺️ Cache'
uses: ./.github/actions/cache

- name: '📦 Install'
uses: ./.github/actions/install

- name: '🏗️ Build'
uses: ./.github/actions/build
with:
COMMAND: 'build'

- name: '🚨️ Lint'
uses: ./.github/actions/lint

- name: '🦺 Type Check'
uses: ./.github/actions/type-check
with:
COMMAND: 'type-check'

- name: '🧪 Test'
uses: ./.github/actions/test
with:
COMMAND: 'test'

- name: '🏷️ Release'
id: release
uses: ./.github/actions/release
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TYPE: ${{ github.event.inputs.type }}
outputs:
version: ${{ steps.release.outputs.version }}
tag: ${{ steps.release.outputs.tag }}
branch: ${{ steps.release.outputs.branch }}

pull-request:
name: '🏷️ Open Pull Request'
runs-on: ubuntu-latest
needs: [create-release]
steps:
- name: '🐙️ Checkout'
uses: actions/checkout@v4
with:
ref: ${{ needs.create-release.outputs.branch }}

- name: '🏷️ Open Pull Request'
uses: thomaseizinger/create-pull-request@master
with:
title: 'chore(release): v${{ needs.create-release.outputs.version }}'
labels: '🏷️ Release v${{ needs.create-release.outputs.version }}'
github_token: ${{ secrets.GITHUB_TOKEN }}
head: release/${{ needs.create-release.outputs.version }}
base: main
2 changes: 2 additions & 0 deletions VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0.0.0
latest