Skip to content

Linux packaging

Linux packaging #9

Workflow file for this run

name: Linux packaging
on:
workflow_call:
inputs:
groupId:
description: "Value from the groupId field in pom.xml. i.e. org.liquibase"
required: true
type: string
artifactId:
description: "Value from the artifactId field in pom.xml. i.e. liquibase"
required: true
type: string
version:
description: "Value from the version field in pom.xml. i.e 4.23.0"
type: string
dry_run:
description: 'Flag to indicate if the workflow is triggered to create a dry-run release'
required: false
type: boolean
default: false
dry_run_zip_url:
description: 'URL of the dry-run zip release'
required: false
type: string
dry_run_tar_gz_url:
description: 'URL of the dry-run tar.gz release'
required: false
type: string
secrets:
GPG_SECRET:
description: "GPG_SECRET from the caller workflow"
required: true
GPG_PASSPHRASE:
description: "GPG_PASSPHRASE from the caller workflow"
required: true
GPG_SECRET_KEY_ID:
description: "GPG_SECRET_KEY_ID from the caller workflow"
required: true
workflow_dispatch:
inputs:
groupId:
description: "Value from the groupId field in pom.xml. i.e. org.liquibase"
required: true
type: string
artifactId:
description: "Value from the artifactId field in pom.xml. i.e. liquibase"
required: true
type: string
version:
description: "Value from the version field in pom.xml. i.e 4.23.0"
type: string
dry_run:
description: 'Flag to indicate if the workflow is triggered to create a dry-run release'
required: false
type: boolean
default: false
dry_run_zip_url:
description: 'URL of the dry-run zip release'
required: false
type: string
dry_run_tar_gz_url:
description: 'URL of the dry-run tar.gz release'
required: false
type: string
env:
MAVEN_VERSION: "3.9.5"
jobs:
upload_packages:
name: Upload ${{ inputs.artifactId }} packages
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Check for existing Homebrew formula PR for ${{ inputs.artifactId }}
id: check-brew-pr
run: |
# Authenticate GitHub CLI
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
# Define the PR title
pr_title="liquibase ${{ inputs.version }}"
# Search for open pull requests with the specified title in the Homebrew/homebrew-core repo
pr_exists=$(gh pr list --repo Homebrew/homebrew-core --state open --search "$pr_title" --json title --jq ".[] | select(.title == \"$pr_title\") | .title" || true)
# Trim any leading/trailing whitespace (if any) from pr_exists
pr_exists=$(echo "$pr_exists" | xargs)
echo "pr_exists: '$pr_exists'"
# Set the environment variable based on whether the PR exists
if [ -n "$pr_exists" ]; then
echo "PR_EXISTS=true" >> $GITHUB_ENV
else
echo "PR_EXISTS=false" >> $GITHUB_ENV
fi
- name: Update Homebrew formula for ${{ inputs.artifactId }}
if: ${{ env.PR_EXISTS == 'false' && inputs.dry_run == false }}
uses: mislav/bump-homebrew-formula-action@v3
with:
formula-name: liquibase
formula-path: Formula/l/liquibase.rb
homebrew-tap: Homebrew/homebrew-core
tag-name: ${{ inputs.version }}
download-url: "https://github.com/liquibase/liquibase/releases/download/v${{ inputs.version }}/liquibase-${{ inputs.version }}.tar.gz"
commit-message: |
{{formulaName}} {{version}}
Created by https://github.com/mislav/bump-homebrew-formula-action
env:
COMMITTER_TOKEN: ${{ secrets.BOT_TOKEN }}