Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Added GitHub Action to publish GitHub release on commit to default br…
Browse files Browse the repository at this point in the history
…anch & SemVer (#9)

* added workflow script for publish

* added workflow script for publish

* remove image name

* add check commit message job

* fix workflow syntax

* this is a Major Release

* move Major Release type check to step in publish

* add dummy output for Major and Minor Release

* add dummy output for Major and Minor Release fix multiline

* added step output Major Release

* test step output Major Release

* test step output Major Release

* test step output Major Release

* test step output Major Release

* fix elif Minor Release

* fix EOF Minor Release

* tweak semver options

* remove if for prepare

* rework with semver action

* test Minor Release

* test Major Release

* cleanup Minor Release Test

* minor release case sensitivity check

* minor release case sensitivity check2

* minor release case sensitivity check2 fix
  • Loading branch information
SweedInsight authored Jan 20, 2021
1 parent c4a8604 commit 5d9500a
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Master

on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
- '*.md'

jobs:
get-publish-version:
runs-on: ubuntu-latest
outputs:
publish-version: ${{ steps.get-publish-version.outputs.publish-version }}
steps:
- name: Prepare SemVer
id: prepare-semver
run: |
LATEST_VERSION=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
[ -z "$LATEST_VERSION" ] && LATEST_VERSION="0.0.0"
echo ::set-output name=latest_version_out::$LATEST_VERSION
commit_message="${{ github.event.head_commit.message }}"
if [[ "${commit_message,,}" == *"major release"* ]]; then
echo ::set-output name=semver_increment::"m"
elif [[ "${commit_message,,}" == *"minor release"* ]]; then
echo ::set-output name=semver_increment::"i"
else
echo ::set-output name=semver_increment::"p"
fi
- name: Increment SemVer
id: semver
uses: matt-FFFFFF/simple-semver@v0.1.0
with:
semver-input: ${{ steps.prepare-semver.outputs.latest_version_out }}
increment: ${{ steps.prepare-semver.outputs.semver_increment }}
- name: Get publish version
id: get-publish-version
run: echo "::set-output name=publish-version::${{ steps.semver.outputs.semver }}"


publish-github-release:
runs-on: ubuntu-latest
needs: [get-publish-version]
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Create GitHub Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.get-publish-version.outputs.publish-version }}
release_name: Release ${{ needs.get-publish-version.outputs.publish-version }}
draft: false
prerelease: false

0 comments on commit 5d9500a

Please sign in to comment.