Skip to content

Commit

Permalink
Update release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Link- committed Oct 14, 2023
1 parent e1da13c commit 4eb1fb0
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 21 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/post-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build & Release

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
build-and-release:
runs-on: ubuntu-latest
steps:

- name: Checkout repository
uses: actions/checkout@v4

- name: Get version number
id: get_version
run: |
echo "version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- uses: actions/create-release@master
name: Create ${{ github.event.inputs.version }} Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ steps.get_version.outputs.version }}"
release_name: "${{ steps.get_version.outputs.version }}"

- name: Publish to NPM
uses: JS-DevTools/npm-publish@0f451a94170d1699fd50710966d48fb26194d939
with:
token: ${{ secrets.NPM_TOKEN }}
38 changes: 17 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
author_email: [email protected]
message: 'Update build'
add: 'bin/starred_search'
new_branch: ${{ github.event.inputs.version }}
push: false

- name: Update version
run: |
Expand All @@ -50,26 +52,20 @@ jobs:
author_email: [email protected]
message: 'Update version'
add: 'package.json'
new_branch: ${{ github.event.inputs.version }}
push: false

- name: Tag version
run: |
git tag ${{ github.event.inputs.version }}
- name: Push tag
uses: EndBug/add-and-commit@a3adef035a1381dcf888c90b847240e2ddb9e008
with:
author_name: Link-
author_email: [email protected]

- uses: actions/create-release@master
name: Create ${{ github.event.inputs.version }} Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ github.event.inputs.version }}"
release_name: "${{ github.event.inputs.version }}"

- name: Release
uses: JS-DevTools/npm-publish@0f451a94170d1699fd50710966d48fb26194d939
- name: Create PR
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.NPM_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Release ${{ github.event.inputs.version }}'
title: 'Release ${{ github.event.inputs.version }}'
branch: ${{ github.event.inputs.version }}
delete-branch: true
labels: |
release
ignore-for-release
reviewers: 'Link-'
assignees: 'Link-'
draft: false

0 comments on commit 4eb1fb0

Please sign in to comment.