Skip to content

Release v3.22.27-criteo #43

Release v3.22.27-criteo

Release v3.22.27-criteo #43

Workflow file for this run

name: Criteo Release Workflow
run-name: Release ${{github.ref_name}}
on:
push:
tags: ['v*-criteo']
jobs:
build-release-assets:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
build_type: [Release]
include:
- os: ubuntu-latest
os_family: linux
arch: x86_64
# macos-latest image is arm64 based
- os: macos-latest
os_family: osx
arch: aarch_64
# macos-13 image is the most recent x86 based macos
- os: macos-13
os_family: osx
arch: x86_64
- os: windows-latest
os_family: windows
arch: x86_64
steps:
- name: Parse version for Unix
if: ${{ matrix.os_family == 'linux' || matrix.os_family == 'osx' }}
# Strip 'v' prefix of the tag
run: |
proto_tag="${{ github.ref_name }}"
echo "proto_version=${proto_tag#v}" >> "$GITHUB_ENV"
- name: Parse version for Windows
if: ${{ matrix.os_family == 'windows' }}
# Strip 'v' prefix of the tag, noting that windows env variable is namespaced with `env:`
run: |
$proto_tag = "${{ github.ref_name }}"
$proto_version = $proto_tag.TrimStart("v")
echo "proto_version=$proto_version" >> "$env:GITHUB_ENV"
- name: Checkout Protobuf
uses: actions/checkout@v4
- name: Checkout submodule
run: git submodule update --init --recursive
- name: Set protoc version for Unix
if: ${{ matrix.os_family == 'linux' || matrix.os_family == 'osx' }}
run: sed -i.bak 's/4\.22\.5/${{ env.proto_version }}/g' CMakeLists.txt
- name: Set protoc version for Windows
if: ${{ matrix.os == 'windows-latest' }}
run: >
(Get-Content CMakeLists.txt) -replace '4.22.5', '${{ env.proto_version }}' | Set-Content CMakeLists.txt
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ github.workspace }}/build
-G "Unix Makefiles"
-DCMAKE_CXX_STANDARD=14
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
- name: Build protoc
run: cmake --build ${{ github.workspace }}/build
- name: Create release artifacts directory for upload
run: mkdir ${{ github.workspace }}/build/release-artifacts
- name: Rename protoc for Unix
if: ${{ matrix.os_family == 'linux' || matrix.os_family == 'osx' }}
run: >
mv $(readlink -f ${{ github.workspace }}/build/protoc)
${{ github.workspace }}/build/release-artifacts/protoc-${{ env.proto_version }}-${{ matrix.os_family }}-${{ matrix.arch }}.exe
- name: Rename protoc for Windows
if: ${{ matrix.os_family == 'windows' }}
run: >
mv ${{ github.workspace }}/build/protoc.exe
${{ github.workspace }}/build/release-artifacts/protoc-${{ env.proto_version }}-${{ matrix.os_family }}-${{ matrix.arch }}.exe
- name: Setup JDK
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/[email protected]
with:
java-version: 8
distribution: temurin
- name: Build Java lib
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
ln -sfn ${{ github.workspace }}/build/release-artifacts/protoc-${{ env.proto_version }}-${{ matrix.os_family }}-${{ matrix.arch }}.exe ${{ github.workspace }}/protoc
cd ${{ github.workspace }}/java
mvn versions:set -DnewVersion=${{ env.proto_version }} -DprocessAllModules=true
mvn package -pl core -am -DskipTests
mvn source:jar -pl core
cp pom.xml ${{ github.workspace }}/build/release-artifacts/protobuf-parent.${{ env.proto_version }}.pom
cp core/pom.xml ${{ github.workspace }}/build/release-artifacts/protobuf-java.${{ env.proto_version }}.pom
cp protoc/pom.xml ${{ github.workspace }}/build/release-artifacts/protoc.${{ env.proto_version }}.pom
mv core/target/protobuf*.jar ${{ github.workspace }}/build/release-artifacts/
- name: Upload artifacts
uses: actions/[email protected]
with:
name: artifacts-${{ env.proto_version }}-${{ matrix.os_family }}-${{ matrix.arch }}
path: ${{ github.workspace }}/build/release-artifacts
retention-days: 7
publish-release-assets:
needs: build-release-assets
runs-on: ubuntu-latest
steps:
- name: Prepare environment
run: |
proto_tag="${{ github.ref_name }}"
proto_version=${proto_tag#v}
mkdir protobuf-dist-$proto_version
mkdir download
echo "proto_version=$proto_version" >> "$GITHUB_ENV"
- name: Download artifacts
uses: actions/[email protected]
with:
pattern: artifacts-*
path: ${{ github.workspace }}/download
- name: Package artifacts
run: |
ls -l download/*
mv download/*/* protobuf-dist-${{ env.proto_version }}/
chmod +x protobuf-dist-${{ env.proto_version }}/protoc-*.exe
ls -l protobuf-dist-${{ env.proto_version }}/
tar -czf protobuf-dist-${{ env.proto_version }}.tar.gz protobuf-dist-${{ env.proto_version }}
- name: Publish artifact
uses: softprops/[email protected]
with:
files: |
protobuf-dist-${{ env.proto_version }}.tar.gz