ruby/ruby-docker-images/nightly #42
This file contains 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: ruby/ruby-docker-images/nightly | |
on: | |
schedule: | |
- cron: '0 */12 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [jammy, focal] | |
debug: ['', '-debug'] | |
dev: ['', '-dev'] | |
runs-on: ubuntu-latest | |
env: | |
nightly: true | |
push: true | |
ubuntu_version: ${{ matrix.os }} | |
ruby_version: master | |
image_version_suffix: ${{ matrix.debug }} | |
tag_suffix: '' | |
push_tags: '' | |
dev_suffix: ${{ matrix.dev }} | |
optflags: '' | |
cppflags: '' | |
debugflags: '' | |
steps: | |
- uses: actions/checkout@v4.1.0 | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASS }} | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GHCR_USER }} | |
password: ${{ secrets.GHCR_ACCESS_TOKEN }} | |
- run: | | |
if [ "${{ env.dev_suffix }}" = "-dev" ]; then | |
echo "target=development" >> $GITHUB_ENV | |
else | |
echo "target=ruby" >> $GITHUB_ENV | |
fi | |
- run: | | |
if [ "${{ env.image_version_suffix }}" = "-debug" ]; then | |
echo "cppflags=-DENABLE_PATH_CHECK=0 -DRUBY_DEBUG=1" >> $GITHUB_ENV | |
echo "optflags=-O3 -fno-inline" >> $GITHUB_ENV | |
fi | |
- name: Build docker image | |
run: |- | |
rake docker:build ruby_version=${{ env.ruby_version }} \ | |
ubuntu_version=${{ env.ubuntu_version }} \ | |
image_version_suffix=${{ env.image_version_suffix }}${{ env.dev_suffix }} \ | |
nightly=${{ env.nightly }} \ | |
tag_suffix=${{ env.tag_suffix }} \ | |
target=${{ env.target }} \ | |
latest_tag=${{ env.latest_tag }} \ | |
arch=linux/amd64 | |
shell: bash | |
- name: List images | |
run: docker images | |
shell: bash | |
- name: Push docker image to rubylang | |
if: ${{ env.push }} | |
run: |- | |
rake docker:push ruby_version=${{ env.ruby_version }} \ | |
ubuntu_version=${{ env.ubuntu_version }} \ | |
image_version_suffix=${{ env.image_version_suffix }}${{ env.dev_suffix }} \ | |
nightly=${{ env.nightly }} \ | |
tag_suffix=${{ env.tag_suffix }} \ | |
latest_tag=false \ | |
registry_name=rubylang | |
shell: bash | |
- name: Push docker image to ghcr.io/ruby | |
if: ${{ env.push }} | |
run: |- | |
rake docker:push ruby_version=${{ env.ruby_version }} \ | |
ubuntu_version=${{ env.ubuntu_version }} \ | |
image_version_suffix=${{ env.image_version_suffix }}${{ env.dev_suffix }} \ | |
nightly=${{ env.nightly }} \ | |
tag_suffix=${{ env.tag_suffix }} \ | |
latest_tag=false \ | |
registry_name=ghcr.io/ruby | |
shell: bash | |
- name: Push docker image to rubylang | |
if: "${{ env.push_tags }}" | |
run: |- | |
push_tags="${{ env.push_tags }}" | |
for tag in $push_tags; do | |
docker push rubylang/ruby:$tag | |
done | |
shell: bash | |
- name: Push docker image to ghcr.io/ruby | |
if: "${{ env.push_tags }}" | |
run: |- | |
push_tags="${{ env.push_tags }}" | |
for tag in $push_tags; do | |
docker tag rubylang/ruby:$tag ghcr.io/ruby/ruby:$tag | |
docker push ghcr.io/ruby/ruby:$tag | |
done | |
shell: bash |