Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add github worflow for creating a release #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/release-pre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: Pre-release
on:
pull_request:

jobs:
prerelease:
name: Pre-release
runs-on: ubuntu-latest

permissions:
contents: write
packages: write

steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
# checkout merge request HEAD instead of merge commit
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
if: ${{ !env.ACT }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: master

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

- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
toTag: ${{ steps.semver.outputs.current }}
fromTag: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Build artifacts
run: make version=${{ steps.semver.outputs.next }}-pre-${{ steps.short_sha.outputs.short_sha }} artifact

- name: Create Draft Release
uses: ncipollo/release-action@v1
if: ${{ !env.ACT }}
with:
allowUpdates: true
artifacts: "rf-liquidsoap*.tar.gz"
body: ${{ steps.changelog.outputs.changes }}
commit: ${{ github.event.pull_request.head.sha }}
draft: true
makeLatest: false
name: ${{ steps.semver.outputs.next }}-pre-${{ github.head_ref }}
prerelease: true
removeArtifacts: true
replacesArtifacts: true
tag: ${{ steps.semver.outputs.next }}-pre-${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
updateOnlyUnreleased: true
74 changes: 74 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
name: Release
on:
workflow_dispatch:
branches:
- master

jobs:
release:
name: Release
runs-on: ubuntu-latest

permissions:
contents: write
packages: write
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
if: ${{ !env.ACT }}
with:
token: ${{ github.token }}
branch: master

- name: Build artifacts
run: make version=${{ steps.semver.outputs.next }} artifact

- name: Create Draft Release
uses: ncipollo/release-action@v1
if: ${{ !env.ACT }}
with:
artifacts: "rf-liquidsoap*.tar.gz"
prerelease: true
draft: false
commit: ${{ github.sha }}
tag: ${{ steps.semver.outputs.next }}
name: ${{ steps.semver.outputs.next }}
body: '*pending*'
token: ${{ github.token }}

- name: Update CHANGELOG
id: changelog
if: ${{ !env.ACT }}
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}

- name: Create Release
if: ${{ !env.ACT }}
uses: ncipollo/release-action@v1
with:
artifacts: "rf-liquidsoap*.tar.gz"
allowUpdates: true
draft: false
makeLatest: true
generateReleaseNotes: true
tag: ${{ steps.semver.outputs.next }}
name: ${{ steps.semver.outputs.next }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}

- name: Commit CHANGELOG.md
if: ${{ !env.ACT }}
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md