0.3.19 #125
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check if prerelease | |
id: check-prerelease | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/v} | |
if [[ "$VERSION" == *"-beta"* || "$VERSION" == *"-alpha"* ]]; then | |
echo "is_prerelease=true" >> $GITHUB_OUTPUT | |
else | |
echo "is_prerelease=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Check branch for beta releases | |
id: check-branch | |
if: steps.check-prerelease.outputs.is_prerelease == 'true' | |
run: | | |
# Get the commit that the tag points to | |
TAG_COMMIT=$(git rev-parse ${{ github.ref }}) | |
echo "Tag commit: $TAG_COMMIT" | |
# Check if this commit is on the develop branch | |
BRANCH_CONTAINS=$(git branch -r --contains $TAG_COMMIT | grep "origin/develop" || true) | |
echo "Branch contains check: $BRANCH_CONTAINS" | |
if [[ -n "$BRANCH_CONTAINS" ]]; then | |
echo "is_valid_branch=true" >> $GITHUB_OUTPUT | |
echo "Tag is on the develop branch" | |
else | |
echo "is_valid_branch=false" >> $GITHUB_OUTPUT | |
echo "Beta releases should only be created from the develop branch" | |
exit 1 | |
fi | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
lakker/pulsarr | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=raw,value=beta,enable=${{ steps.check-prerelease.outputs.is_prerelease == 'true' }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Generate Release Notes | |
uses: release-drafter/release-drafter@v5 | |
id: release-drafter | |
with: | |
config-name: release-drafter.yml | |
tag: ${{ github.ref_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body: ${{ steps.release-drafter.outputs.body }} | |
draft: false | |
prerelease: ${{ steps.check-prerelease.outputs.is_prerelease == 'true' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |