Skip to content

Commit

Permalink
ci(release): add prerelease workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
uZer committed Jun 21, 2024
1 parent 31b1579 commit c2e3293
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 55 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/release-pre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
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:
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: Build artifacts
run: make version=${{ steps.semver.outputs.next }}-${{ 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"
commit: ${{ steps.short_sha.outputs.short_sha }}
draft: true
generateReleaseNotes: true
makeLatest: false
name: ${{ steps.semver.outputs.next }}-pre
omitBodyDuringUpdate: true
prerelease: true
removeArtifacts: true
replacesArtifacts: true
tag: ${{ steps.semver.outputs.next }}-pre
token: ${{ secrets.GITHUB_TOKEN }}
updateOnlyUnreleased: true
114 changes: 59 additions & 55 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,74 @@
---
name: Release
on: # yamllint disable-line rule:truthy
on:
workflow_dispatch:
branches:
- master

jobs:
build-and-release:
name: Build & Release
release:
name: Release
runs-on: ubuntu-latest

permissions:
contents: read
contents: write
packages: write
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- 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: 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: Build artifacts
run: make version=${{ steps.semver.outputs.next }} artifact

- name: Create Draft Release
uses: ncipollo/release-action@v1.12.0
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: 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: 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
tag: ${{ steps.semver.outputs.next }}
name: ${{ steps.semver.outputs.next }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
- 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
- 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

0 comments on commit c2e3293

Please sign in to comment.