This repository has been archived by the owner on Dec 11, 2023. It is now read-only.
feature/formatted-model-item #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
pull_request: | |
types: [closed] | |
branches: [main] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
environment: production | |
if: github.event.pull_request.merged | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: get package version | |
id: package_version | |
uses: Saionaro/extract-package-version@v1.0.6 | |
- name: add v | |
id: version | |
run: echo "::set-output name=value::${{ format('v{0}', steps.package_version.outputs.version) }}" | |
- name: print package version | |
run: | | |
echo "package version: ${{ steps.version.outputs.value }}" | |
- name: get tag version | |
id: tag_version | |
uses: WyriHaximus/github-action-get-previous-tag@v1 | |
- name: print tag version | |
run: | | |
echo 'tag version: ${{ steps.tag_version.outputs.tag }}' | |
- name: push tag | |
if: ${{ steps.version.outputs.value != steps.tag_version.outputs.tag }} | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git tag -a "${{ steps.version.outputs.value}}" -m "${{ steps.version.outputs.value }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}" | |
git push origin "${{ steps.version.outputs.value}}" | |
- name: setup node.js | |
if: ${{ steps.version.outputs.value != steps.tag_version.outputs.tag }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: npm publish | |
if: ${{ steps.version.outputs.value != steps.tag_version.outputs.tag }} | |
run: | | |
npm ci | |
npm run build | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM }} | |
- name: build release notes | |
if: ${{ steps.version.outputs.value != steps.tag_version.outputs.tag }} | |
id: release_notes | |
uses: mikepenz/release-changelog-builder-action@v3.6.0 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: create release | |
if: ${{ steps.version.outputs.value != steps.tag_version.outputs.tag }} | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
tag_name: ${{ steps.version.outputs.value }} | |
title: '${{ steps.version.outputs.value }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}' | |
body: ${{steps.release_notes.outputs.changelog}} | |