Skip to content

Commit

Permalink
chore: Create pre-release and release from merge to main (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
tallnato authored Aug 26, 2024
1 parent e3fbc0b commit 9fdc26e
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/merge-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Merge main

on:
push:
branches:
- main

jobs:

prepare:
name: Calculate Version and Build Number
runs-on:
- ubuntu-latest

outputs:
build_number: ${{ steps.short_sha.outputs.value }}
new_release: ${{ steps.semantic.outputs.new_release_published }}
release: ${{ steps.semantic.outputs.new_release_version }}
release_notes: ${{ steps.semantic.outputs.new_release_notes }}

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}

- uses: cycjimmy/semantic-release-action@v4
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
dry_run: true

- name: Git Short sha
id: short_sha
run: echo "value=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

releases:
if: needs.prepare.outputs.new_release == 'true'

name: Dev and Draft Releases
runs-on:
- self-hosted

needs:
- prepare

steps:
- name: Create Pre Release
uses: actions/create-release@v1
env:
BUILD: ${{ needs.prepare.outputs.build_number }}
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
VERSION: ${{ needs.prepare.outputs.release }}
with:
tag_name: ${{ env.VERSION }}.${{ env.BUILD }}
release_name: ${{ env.VERSION }}.${{ env.BUILD }}
body: ${{ github.event.head_commit.message }}
prerelease: true

- name: Delete Previous drafts
uses: hugo19941994/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

- name: Create Draft Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
tag_name: ${{ needs.prepare.outputs.release }}
release_name: ${{ needs.prepare.outputs.release }}
body: ${{ needs.prepare.outputs.release_notes }}
draft: true

0 comments on commit 9fdc26e

Please sign in to comment.