Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Make draft release package #167

Make draft release package

Make draft release package #167

Workflow file for this run

name: Make draft release package
on:
push:
tags:
- 'draft/v*' # e.g. draft/v2_6_4
repository_dispatch:
types:
- "refs/tags/v*" # e.g. refs/tags/v2_6_4
workflow_dispatch:
inputs:
TARGET_VERSION:
description: Packaging target version
required: true
default: 3.0.0-preview1
jobs:
make-snapshot:
runs-on: ubuntu-latest
steps:
- name: Set TARGET_VERSION
run: |
if [ -z "$TARGET_VERSION" ]; then
GITHUB_REF=${GITHUB_EVENT_ACTION:-$(echo $GITHUB_REF | sed -e "s#/draft/#/#")}
TARGET_VERSION=$(echo $GITHUB_REF | sed -e "s#refs/tags/v##" -e "s/_\([a-z]\)/-\1/" -e "y/_/./")
fi
echo TARGET_VERSION="$TARGET_VERSION" >> $GITHUB_ENV
echo TARGET_VERSION="$TARGET_VERSION" >> $GITHUB_OUTPUT
shell: bash
id: info
env:
GITHUB_EVENT_ACTION: ${{ github.event.action }} # repository_dispatch
TARGET_VERSION: ${{ github.event.inputs.TARGET_VERSION }} # workflow_dispatch
- name: Install libraries
run: |
set -x
sudo apt-get update -q || :
sudo apt-get install --no-install-recommends -q -y build-essential git bison autoconf ruby p7zip-full curl
- name: Checkout ruby/ruby for tool/make-snapshot
run: git clone --single-branch --depth=1 https://github.com/ruby/ruby ruby
- name: Make pkg
run: |
set -x
GITHUB_REF_RUBY_RUBY=refs/tags/v$(echo $TARGET_VERSION | sed 'y/.-/__/')
if ruby -e "major, minor, = '${TARGET_VERSION}'.split('.').map(&:to_i); exit(major<=2 && minor<7)"; then
# e.g. GITHUB_REF=refs/tags/draft/v2_6_4 -> TARGET_VERSION=2.6.4
ruby ruby/tool/make-snapshot -svn pkg ${TARGET_VERSION}
echo PACKAGE_EXTS=".tar.gz .tar.bz2 .tar.xz .zip" >> $GITHUB_ENV
else
# e.g. GITHUB_REF=refs/tags/draft/v2_7_0_preview1 -> TARGET_VERSION=2.7.0-preview1
pushd ruby
git fetch --shallow-since='2018-12-25 00:00:00'
git fetch origin "+${GITHUB_REF_RUBY_RUBY}:${GITHUB_REF_RUBY_RUBY}"
git fetch origin +refs/notes/commits:refs/notes/commits
git fetch origin +refs/notes/log-fix:refs/notes/log-fix
popd
if ruby -e "major, minor, = '${TARGET_VERSION}'.split('.').map(&:to_i); exit(major<3)"; then
ruby ruby/tool/make-snapshot -srcdir=ruby pkg ${TARGET_VERSION}
echo PACKAGE_EXTS=".tar.gz .tar.bz2 .tar.xz .zip" >> $GITHUB_ENV
else
# exclude bzip from -packages
ruby ruby/tool/make-snapshot -srcdir=ruby -packages=gzip,xz,zip pkg ${TARGET_VERSION}
echo PACKAGE_EXTS=".tar.gz .tar.xz .zip" >> $GITHUB_ENV
fi
fi
- uses: actions/upload-artifact@v4
with:
name: Packages
path: pkg
- uses: actions/upload-artifact@v4
with:
name: Info
path: pkg/info
- name: Check pkg
run: |
set -x
ls -al pkg
7z x pkg/ruby-${TARGET_VERSION}.zip ruby-${TARGET_VERSION}/revision.h
cat ruby-${TARGET_VERSION}/revision.h
7z l pkg/ruby-${TARGET_VERSION}.zip ruby-${TARGET_VERSION}/ChangeLog
- name: Upload s3
run: |
set -x
for ext in $PACKAGE_EXTS; do
aws s3 cp "pkg/ruby-${TARGET_VERSION}$ext" "s3://ftp.r-l.o/pub/tmp/ruby-${TARGET_VERSION}-draft$ext" --no-progress
curl -sS -X PURGE -H "Fastly-Soft-Purge:1" "https://cache.ruby-lang.org/pub/tmp/ruby-${TARGET_VERSION}-draft$ext"
done
aws s3 cp "pkg/info/info.yml" "s3://ftp.r-l.o/pub/tmp/ruby-info-${TARGET_VERSION}-draft.yml" --no-progress
curl -sS -X PURGE -H "Fastly-Soft-Purge:1" "https://cache.ruby-lang.org/pub/tmp/ruby-info-${TARGET_VERSION}-draft.yml"
curl -sS -X PURGE -H "Fastly-Soft-Purge:1" "https://cache.ruby-lang.org/pub/tmp/"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.FTP_R_L_O_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.FTP_R_L_O_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-west-2
- uses: ruby/[email protected]
with:
payload: |
{
"attachments": [{
"title": "Build Draft Release ${{ steps.info.outputs.TARGET_VERSION }}",
"title_link": "https://cache.ruby-lang.org/pub/tmp/",
"text": "${{ job.status }}: make-snapshot <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} at ${{ steps.info.outputs.TARGET_VERSION }}>",
"color": "danger"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: failure()
- uses: ruby/[email protected]
with:
payload: |
{
"attachments": [{
"title": "Build Draft Release ${{ steps.info.outputs.TARGET_VERSION }}",
"title_link": "https://cache.ruby-lang.org/pub/tmp/",
"text": "${{ job.status }}: make-snapshot <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} at ${{ steps.info.outputs.TARGET_VERSION }}>",
"color": "good"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: success()
ubuntu:
needs: make-snapshot
strategy:
matrix:
test_task: [check, test-bundler-parallel, test-bundled-gems]
os: [ubuntu-24.04, ubuntu-22.04]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Set TARGET_VERSION
run: |
if [ -z "$TARGET_VERSION" ]; then
GITHUB_REF=${GITHUB_EVENT_ACTION:-$(echo $GITHUB_REF | sed -e "s#/draft/#/#")}
TARGET_VERSION=$(echo $GITHUB_REF | sed -e "s#refs/tags/v##" -e "s/_\([a-z]\)/-\1/" -e "y/_/./")
fi
echo TARGET_VERSION="$TARGET_VERSION" >> $GITHUB_ENV
echo TARGET_VERSION="$TARGET_VERSION" >> $GITHUB_OUTPUT
shell: bash
id: info
env:
GITHUB_EVENT_ACTION: ${{ github.event.action }} # repository_dispatch
TARGET_VERSION: ${{ github.event.inputs.TARGET_VERSION }} # workflow_dispatch
- run: env | sort
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- uses: actions/download-artifact@v4
with:
name: Packages
path: pkg
- name: Extract
run: tar xf pkg/ruby-*.tar.xz
- name: Install libraries
run: |
set -x
sudo apt-get update -q || :
# postfix `-` means `uninstall`
APT_INSTALL_RUBY=ruby-
APT_INSTALL_GIT=git-
case "${{ matrix.test_task }}" in
test-bundled-gems)
# test-bundled-gems requires executable host ruby
APT_INSTALL_RUBY=ruby
# test-bundled-gems-fetch requires git
unset APT_INSTALL_GIT
;;
test-bundler*)
# avoid Bundler::Source::Git::GitNotInstalledError
unset APT_INSTALL_GIT
;;
*)
;;
esac
sudo apt-get install --no-install-recommends -q -y build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev bison- autoconf- $APT_INSTALL_RUBY $APT_INSTALL_GIT
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
# test-bundled-gems requires executable host ruby
if: "${{ matrix.test_task == 'test-bundled-gems' }}"
- name: Fixed world writable dirs
run: |
mkdir -p $HOME/.gem
chmod -v a-w $HOME $HOME/.config
sudo chmod -R a-w /usr/share
sudo bash -c 'IFS=:; for d in '"$PATH"'; do chmod -v a-w $d; done' || :
- name: mkdir ~/.local
run: ls -al $HOME && sudo mkdir -p $HOME/.local && sudo chown $USER $HOME/.local
- name: mkdir ~/.cache
run: ls -al $HOME && sudo mkdir -p $HOME/.cache && sudo chown $USER $HOME/.cache
- name: Set ENV
run: |
echo "JOBS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV
- name: configure
run: cd ruby-*/ && ./configure
- name: make
run: cd ruby-*/ && make $JOBS
- name: Tests
run: |
cd ruby-*/ && env -u XDG_CONFIG_HOME make $JOBS -s ${{ matrix.test_task }}
env:
MSPECOPT: "-j"
RUBY_TESTOPTS: "-q --tty=no"
- name: make install without root privilege
run: cd ruby-*/ && make $JOBS install DESTDIR="/tmp/destdir"
if: matrix.test_task == 'check'
- name: make install
run: cd ruby-*/ && sudo make $JOBS install
if: matrix.test_task == 'check'
- name: ruby -v
run: ruby -v
if: matrix.test_task == 'check'
- uses: ruby/[email protected]
with:
payload: |
{
"attachments": [{
"text": "${{ job.status }}: ${{ matrix.os }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} at ${{ steps.info.outputs.TARGET_VERSION }}>",
"color": "danger"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: failure()
- uses: ruby/[email protected]
with:
payload: |
{
"attachments": [{
"text": "${{ job.status }}: ${{ matrix.os }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} at ${{ steps.info.outputs.TARGET_VERSION }}>",
"color": "good"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: success()
macos:
needs: make-snapshot
strategy:
matrix:
test_task: [check, test-bundled-gems]
os: [macos-13, macos-14] #, macos-15] macos-15 doesn't work yet
include:
- os: macos-14
test_task: test-bundler-parallel
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Set TARGET_VERSION
run: |
if [ -z "$TARGET_VERSION" ]; then
GITHUB_REF=${GITHUB_EVENT_ACTION:-$(echo $GITHUB_REF | sed -e "s#/draft/#/#")}
TARGET_VERSION=$(echo $GITHUB_REF | sed -e "s#refs/tags/v##" -e "s/_\([a-z]\)/-\1/" -e "y/_/./")
fi
echo TARGET_VERSION="$TARGET_VERSION" >> $GITHUB_ENV
echo TARGET_VERSION="$TARGET_VERSION" >> $GITHUB_OUTPUT
shell: bash
id: info
env:
GITHUB_EVENT_ACTION: ${{ github.event.action }} # repository_dispatch
TARGET_VERSION: ${{ github.event.inputs.TARGET_VERSION }} # workflow_dispatch
- run: env | sort
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- uses: actions/download-artifact@v4
with:
name: Packages
path: pkg
- name: Extract
run: tar xf pkg/ruby-*.tar.xz
- name: Install libraries
run: |
with_retry () {
"$@" || { sleep 5 && "$@"; } || { sleep 60 && "$@"; }
}
set -x
with_retry brew install gdbm gmp libffi [email protected] zlib autoconf automake libtool readline
- name: Set ENV
run: |
echo "JOBS=-j$((1 + $(sysctl -n hw.activecpu)))" >> $GITHUB_ENV
- name: configure
run: cd ruby-*/ && ./configure --with-openssl-dir=$(brew --prefix [email protected]) --with-readline-dir=$(brew --prefix readline)
- name: make
run: cd ruby-*/ && make $JOBS
- name: Tests
run: |
case "$TARGET_VERSION" in
2.6.*)
test "${{ matrix.test_task }}" = test-bundler && exit
test "${{ matrix.test_task }}" = test-bundled-gems && exit
;;
esac
cd ruby-*/ && make $JOBS -s ${{ matrix.test_task }}
env:
MSPECOPT: "-ff" # not using `-j` because sometimes `mspec -j` silently dies (for ruby < 2.7)
RUBY_TESTOPTS: "-q --tty=no"
- name: make install without root privilege
run: cd ruby-*/ && make $JOBS install DESTDIR="/tmp/destdir"
if: matrix.test_task == 'check'
- name: make install
run: cd ruby-*/ && sudo make $JOBS install
if: matrix.test_task == 'check'
- name: ruby -v
run: /usr/local/bin/ruby -v
if: matrix.test_task == 'check'
- uses: ruby/[email protected]
with:
payload: |
{
"attachments": [{
"text": "${{ job.status }}: ${{ matrix.os }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} at ${{ steps.info.outputs.TARGET_VERSION }}>",
"color": "danger"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: failure()
- uses: ruby/[email protected]
with:
payload: |
{
"attachments": [{
"text": "${{ job.status }}: ${{ matrix.os }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} at ${{ steps.info.outputs.TARGET_VERSION }}>",
"color": "good"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: success()
windows:
needs: make-snapshot
strategy:
matrix:
os: [windows-2022]
vs: [2022]
vcvars: ['10.0.22621.0 -vcvars_ver=14.2']
test_task: [test]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
PATCH: C:\msys64\usr\bin\patch.exe
steps:
- name: Set TARGET_VERSION
run: |
if [ -z "$TARGET_VERSION" ]; then
GITHUB_REF=${GITHUB_EVENT_ACTION:-$(echo $GITHUB_REF | sed -e "s#/draft/#/#")}
TARGET_VERSION=$(echo $GITHUB_REF | sed -e "s#refs/tags/v##" -e "s/_\([a-z]\)/-\1/" -e "y/_/./")
fi
echo TARGET_VERSION="$TARGET_VERSION" >> $GITHUB_ENV
echo TARGET_VERSION="$TARGET_VERSION" >> $GITHUB_OUTPUT
shell: bash
id: info
env:
GITHUB_EVENT_ACTION: ${{ github.event.action }} # repository_dispatch
TARGET_VERSION: ${{ github.event.inputs.TARGET_VERSION }} # workflow_dispatch
- run: env | sort
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- uses: msys2/setup-msys2@v2
id: setup-msys2
with:
update: true
install: >-
bison
- name: Install libraries with vcpkg
run: |
vcpkg --triplet x64-windows install readline openssl zlib
- uses: actions/download-artifact@v4
with:
name: Packages
path: pkg
- name: Extract
run: 7z x pkg/ruby-*.zip
- name: setup env
# %TEMP% is inconsistent with %TMP% and test-all expects they are consistent.
# https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
run: |
if not "%VCVARS%" == "" goto :vcset
set VCVARS="C:\Program Files (x86)\Microsoft Visual Studio\${{ matrix.vs }}\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
if not exist %VCVARS% set VCVARS="C:\Program Files\Microsoft Visual Studio\${{ matrix.vs }}\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
:vcset
set | C:\msys64\usr\bin\sort > old.env
call %VCVARS% ${{ matrix.vcvars }}
set TMP=%USERPROFILE%\AppData\Local\Temp
set TEMP=%USERPROFILE%\AppData\Local\Temp
set /a TEST_JOBS=(15 * %NUMBER_OF_PROCESSORS% / 10) > nul
set | C:\msys64\usr\bin\sort > new.env
C:\msys64\usr\bin\comm -13 old.env new.env >> %GITHUB_ENV%
del *.env
- name: link libraries
run: |
for %%I in (C:\vcpkg\installed\x64-windows\bin\*.dll) do (
if not %%~nI == readline mklink %%~nxI %%I
)
for %%I in (libcrypto-1_1-x64 libssl-1_1-x64) do (
ren c:\Windows\System32\%%I.dll %%I.dll_
)
- name: configure
run: |
cd ruby-*
win32/configure.bat --disable-install-doc --without-ext=+,dbm,gdbm --enable-bundled-libffi --with-opt-dir=C:/vcpkg/installed/x64-windows
shell: cmd
- name: nmake
run: |
cd ruby-*
nmake up
nmake
shell: cmd
env:
YACC: bison
- name: nmake test
run: |
cd ruby-*
nmake ${{ matrix.test_task }}
shell: cmd
env:
YACC: bison
- name: ruby -v
run: |
cd ruby-*
.\ruby -v
- uses: ruby/[email protected]
with:
payload: |
{
"attachments": [{
"text": "${{ job.status }}: ${{ matrix.os }} (vs${{ matrix.vs }}) / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} at ${{ steps.info.outputs.TARGET_VERSION }}>",
"color": "danger"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: failure()
- uses: ruby/[email protected]
with:
payload: |
{
"attachments": [{
"text": "${{ job.status }}: ${{ matrix.os }} (vs${{ matrix.vs }}) / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} at ${{ steps.info.outputs.TARGET_VERSION }}>",
"color": "good"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: success()
release:
needs: [ubuntu, macos, windows]
runs-on: ubuntu-latest
steps:
- name: Set TARGET_VERSION
run: |
if [ -z "$TARGET_VERSION" ]; then
GITHUB_REF=${GITHUB_EVENT_ACTION:-$(echo $GITHUB_REF | sed -e "s#/draft/#/#")}
TARGET_VERSION=$(echo $GITHUB_REF | sed -e "s#refs/tags/v##" -e "s/_\([a-z]\)/-\1/" -e "y/_/./")
fi
echo TARGET_VERSION="$TARGET_VERSION" >> $GITHUB_ENV
shell: bash
env:
GITHUB_EVENT_ACTION: ${{ github.event.action }} # repository_dispatch
TARGET_VERSION: ${{ github.event.inputs.TARGET_VERSION }} # workflow_dispatch
- name: Create a release pull-request on GitHub
run: |
curl -L -X POST \
-H "Authorization: Bearer ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/ruby/www.ruby-lang.org/dispatches \
-d '{"event_type": "release", "client_payload": {"version": "${{ env.TARGET_VERSION }}"}}'