Skip to content

Release

Release #5

Workflow file for this run

name: Release
on:
workflow_dispatch:
env:
HOMEBREW_DEVELOPER: 1
HOMEBREW_NO_AUTO_UPDATE: 1
permissions:
contents: write
packages: write
jobs:
determine-tag:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.determine-tag.outputs.tag }}
steps:
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
test-bot: false
- name: Determine tag
id: determine-tag
run: |
brew ruby -e "$(cat<<EOS
require "formula"
tag = Formula["portable-ruby"].pkg_version.to_s
existing_tag = Utils.safe_popen_read("git", "tag", "--list", tag)
raise "Tag #{tag} already exists" if existing_tag.present?
puts "Preparing for #{tag} release."
File.open(ENV["GITHUB_OUTPUT"], "a") { |f| f.puts "tag=#{tag}" }
EOS
)"
build:
needs: determine-tag
uses: ./.github/workflows/build.yml
release:
needs: [determine-tag, build]
runs-on: ubuntu-latest
env:
TAG: ${{ needs.determine-tag.outputs.tag }}
steps:
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
test-bot: false
- name: Checkout branch
run: git checkout "${{ github.ref_name }}"
- name: Install gems
run: brew install-bundler-gems
- name: Configure Git user
uses: Homebrew/actions/git-user-config@master
- name: Setup directory
run: mkdir bottles
- name: Download bottles
uses: actions/download-artifact@v3
with:
name: bottles
path: bottles
- name: Upload to GitHub Packages
working-directory: bottles
env:
HOMEBREW_GITHUB_PACKAGES_USER: ${{ github.actor }}
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{ github.token }}
run: brew pr-upload --debug --upload-only --root-url=https://ghcr.io/v2/${GITHUB_REPOSITORY_OWNER,,}/portable-ruby
- name: Push tag
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create "${TAG}" --notes "Portable Ruby ${TAG}" --target "$(git rev-parse --verify HEAD)"
- name: Upload to GitHub Releases
working-directory: bottles
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }}
run: brew pr-upload --debug --upload-only --root-url=https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG}
- name: Cleanup
run: rm -rvf bottles