Skip to content

Release v1.2.2 (#921) #1

Release v1.2.2 (#921)

Release v1.2.2 (#921) #1

name: BE/CD - [PROD] Build & Deploy
on:
push:
branches: be/release
jobs:
check-commit:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.check.outputs.result }}
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Check commit message
id: check
run: echo "result=$(echo '${{ github.event.head_commit.message }}' | grep -oP '^Release v(\d|\.)+$')" >> $GITHUB_OUTPUT
shell: bash
- name: Get version
id: get-version
run: echo "version=$(echo '${{ github.event.head_commit.message }}' | grep -oP 'v(\d|\.)+')" >> $GITHUB_OUTPUT
shell: bash
create-tag:
runs-on: ubuntu-latest
needs: [ "check-commit" ]
if: ${{ needs.check-commit.outputs.result != '' }}
outputs:
tag-exists: ${{ steps.create-tag.outputs.tag_exists }}
release-body: ${{ steps.generate-body.outputs.body }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate body
id: generate-body
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
git_logs=$(git log "$(git describe --tags --abbrev=0)"..HEAD)
git_logs="${git_logs//$'\n'/$'\n'- }"
{
echo "body<<$EOF"
echo "- $git_logs"
echo "$EOF"
} >>"$GITHUB_OUTPUT"
shell: bash
- uses: rickstaa/action-create-tag@v1
id: create-tag
with:
tag: ${{ needs.check-commit.outputs.version }}
tag_exists_error: true
message: ${{ needs.check-commit.outputs.version }}
create-release:
runs-on: ubuntu-latest
needs: [ "check-commit", "create-tag" ]
if: ${{ needs.create-tag.outputs.tag-exists == 'false' }}
steps:
- uses: actions/checkout@v3
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.check-commit.outputs.version }}
name: ${{ needs.check-commit.outputs.version }}
body: ${{ needs.create-tag.outputs.release-body }}