mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
163 lines
6.5 KiB
YAML
163 lines
6.5 KiB
YAML
name: Make draft release package
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build-draft-release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- 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"
|
|
- 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 --depth=1 https://github.com/ruby/ruby ruby
|
|
- name: Make pkg
|
|
run: |
|
|
set -x
|
|
GITHUB_REF=$(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/_/./")
|
|
if ruby -e "major, minor, = '${TARGET_VERSION}'.split('.').map(&:to_i); exit(major<=2 && minor<7)"; then
|
|
ruby ruby/tool/make-snapshot -svn pkg ${TARGET_VERSION}
|
|
else
|
|
# e.g. refs/tags/draft/v2_7_0_preview1
|
|
pushd ruby
|
|
git fetch --shallow-since='2018-12-25 00:00:00'
|
|
git fetch origin "+${GITHUB_REF}:${GITHUB_REF}"
|
|
git fetch origin +refs/notes/commits:refs/notes/commits
|
|
popd
|
|
ruby ruby/tool/make-snapshot -srcdir=ruby pkg ${TARGET_VERSION}
|
|
fi
|
|
- name: Check pkg
|
|
run: |
|
|
set -x
|
|
GITHUB_REF=$(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/_/./")
|
|
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
|
|
GITHUB_REF=$(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/_/./")
|
|
for ext in .tar.gz .tar.bz2 .tar.xz .zip; 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
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
- uses: k0kubun/action-slack@v2.0.0
|
|
with:
|
|
payload: |
|
|
{
|
|
"attachments": [{
|
|
title: "Draft Release ${{ github.ref }}",
|
|
title_link: "https://cache.ruby-lang.org/pub/tmp/",
|
|
"text": "${{ job.status }}: <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ github.workflow }}> ",
|
|
"color": "danger"
|
|
}]
|
|
}
|
|
env:
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
if: failure()
|
|
|
|
check-draft-release:
|
|
needs: build-draft-release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Install libraries
|
|
run: |
|
|
set -x
|
|
sudo apt-get update -q
|
|
sudo apt-get install --no-install-recommends -q -y build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev bison- autoconf- ruby- git-
|
|
- name: Download draft
|
|
run: |
|
|
set -x
|
|
GITHUB_REF=$(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/_/./")
|
|
curl -sSLO https://cache.ruby-lang.org/pub/tmp/ruby-${TARGET_VERSION}-draft.tar.xz
|
|
- name: Extract
|
|
run: |
|
|
set -x
|
|
GITHUB_REF=$(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/_/./")
|
|
tar xf ruby-${TARGET_VERSION}-draft.tar.xz
|
|
- name: Fixed world writable dirs
|
|
run: |
|
|
chmod go-w $HOME
|
|
sudo chmod -R go-w /usr/share
|
|
- name: Set ENV
|
|
run: |
|
|
echo '##[set-env name=JOBS]'-j$((1 + $(nproc --all)))
|
|
- name: configure
|
|
run: cd ruby-*/ && ./configure
|
|
- name: make
|
|
run: cd ruby-*/ && make $JOBS
|
|
- name: make check
|
|
run: cd ruby-*/ && make $JOBS check TESTOPTS="-q --tty=no" MSPECOPT="-ff"
|
|
- name: make install
|
|
run: cd ruby-*/ && sudo make $JOBS install
|
|
if: always() # `make check` may fail when 2.4.x
|
|
- name: ruby -v
|
|
run: ruby -v
|
|
if: always() # `make check` may fail when 2.4.x
|
|
- uses: k0kubun/action-slack@v2.0.0
|
|
with:
|
|
payload: |
|
|
{
|
|
"attachments": [{
|
|
title: "Check Draft Release ${{ github.ref }}",
|
|
title_link: "https://cache.ruby-lang.org/pub/tmp/",
|
|
"text": "${{ job.status }}: <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ github.workflow }} check-draft-release>",
|
|
"color": "danger"
|
|
}]
|
|
}
|
|
env:
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
if: failure()
|
|
- uses: k0kubun/action-slack@v2.0.0
|
|
with:
|
|
payload: |
|
|
{
|
|
"attachments": [{
|
|
title: "Check Draft Release ${{ github.ref }}",
|
|
title_link: "https://cache.ruby-lang.org/pub/tmp/",
|
|
"text": "${{ job.status }}: <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ github.workflow }} check-draft-release>",
|
|
"color": "good"
|
|
}]
|
|
}
|
|
env:
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
if: success()
|