Skip to content

Commit

Permalink
refactor project
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanbokvad committed Oct 2, 2023
1 parent 5972bc6 commit 7695f96
Showing 1 changed file with 4 additions and 58 deletions.
62 changes: 4 additions & 58 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,9 @@
name: Creating Release

name: Creating release
run-name: ${{ github.actor }} creating a release
on:
pull_request:
types: [closed]

jobs:
release:
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies and build
run: npm ci && npm run build

- name: 'Get latest release tag'
id: latest_release
run: |
current_version=`gh release list --limit 30 | grep Latest | awk '{ print $1;}'`
if [ -z "$current_version" ]
then
echo "No release found"
echo "Creating tag for firt release"
echo "version=v1.0.0" >> $GITHUB_ENV
else
echo "version=${current_version}" >> $GITHUB_ENV
fi
env:
GH_TOKEN: ${{ github.token }}

- name: Display version
run: |
# Display the version from the environment
echo "Latest Version: ${{ env.version }}"
- id: label
uses: zwaldowski/match-label-action@v4
with:
allowed: major,minor,patch
default_match: none

- uses: actions-ecosystem/action-bump-semver@v1
if: ${{ steps.label.outputs.match != 'none' }}
id: bump-semver
with:
current_version: ${{ env.version }}
level: ${{steps.label.outputs.match}}

- name: 'Creating Release'
if: ${{ steps.label.outputs.match != 'none' }}
run: |
gh release create ${{ steps.bump-semver.outputs.new_version }} --title " ${{ steps.bump-semver.outputs.new_version }}" --generate-notes
env:
GH_TOKEN: ${{ github.token }}

- uses: JasonEtco/build-and-tag-action@v2
if: ${{ steps.label.outputs.match != 'none' }}
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ steps.bump-semver.outputs.new_version }}
call-release-workflow:
uses: omegapoint/cydig-reusable-workflows/.github/workflows/release.yml@main

0 comments on commit 7695f96

Please sign in to comment.