Begin release process

This commit is contained in:
FriwiDev 2021-11-15 21:50:29 +01:00
parent bf5b6851c5
commit c30360828d
6 changed files with 137 additions and 11 deletions

View File

@ -3,14 +3,55 @@ name: build
on:
workflow_dispatch:
inputs:
repo:
description: 'Git repository to clone'
required: true
default: 'https://bitbucket.org/chromiumembedded/java-cef.git'
ref:
description: 'Git commit id to checkout'
required: false
required: true
default: 'master'
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Generate release info
run: |
chmod +x tools/create_release_info.sh
./create_release_info.sh ${{ github.event.inputs.repo }} ${{ github.event.inputs.ref }} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} ${{github.run_number}}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: ${{env.release_name}}
tag_name: ${{env.release_tag_name}}
body_path: tools/release_message.md
- name: Add LICENSE
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: tools/LICENSE.txt
asset_name: LICENSE
asset_content_type: text/plain
- name: Add build_meta.json
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: tools/build_meta.json
asset_name: build_meta.json
asset_content_type: application/json
linux-amd64:
runs-on: ubuntu-latest
needs: create-release
steps:
- uses: actions/checkout@v1
- name: Set up QEMU
@ -24,7 +65,7 @@ jobs:
name: Build
run: |
chmod +x compile_linux.sh
./compile_linux.sh amd64 Release ${{ github.event.inputs.ref }}
./compile_linux.sh amd64 Release ${{ github.event.inputs.repo }} ${{ github.event.inputs.ref }}
-
name: Export artifacts
uses: actions/upload-artifact@v2
@ -35,6 +76,7 @@ jobs:
linux-i386:
runs-on: ubuntu-latest
needs: create-release
steps:
- uses: actions/checkout@v1
- name: Set up QEMU
@ -48,7 +90,7 @@ jobs:
name: Build
run: |
chmod +x compile_linux.sh
./compile_linux.sh 386 Release ${{ github.event.inputs.ref }}
./compile_linux.sh 386 Release ${{ github.event.inputs.repo }} ${{ github.event.inputs.ref }}
-
name: Export artifacts
uses: actions/upload-artifact@v2

4
.gitignore vendored
View File

@ -1,2 +1,4 @@
out
tools/*.txt
tools/*.md
tools/*.json

View File

@ -6,7 +6,8 @@ ARG BUILD_TYPE
#Declare architecture argument (386 or amd64)
ARG TARGETARCH
#Declare git ref
#Declare git args
ARG REPO
ARG REF
WORKDIR /builder

View File

@ -1,19 +1,20 @@
#!/bin/bash
if [ $# -lt 2 ]
if [ $# -lt 2 ] || [ $# -eq 3 ]
then
echo "Usage: ./compile_linux.sh <architecture> <buildType> [ref]"
echo "Usage: ./compile_linux.sh <architecture> <buildType> [<gitrepo> <gitref>]"
echo ""
echo "architecture: the target architecture to build for. Architectures are either 386 or amd64."
echo "buildType: either Release or Debug"
echo "ref: the git commit id to pull"
echo "gitrepo: git repository url to clone"
echo "gitref: the git commit id to pull"
exit 1
fi
#Execute buildx with linux dockerfile and output to current directory
if [ $# -eq 2 ]
then
docker buildx build --platform=linux/$1 --build-arg TARGETARCH=$1 --build-arg BUILD_TYPE=$2 --build-arg REF=master --file DockerfileLinux --output out .
docker buildx build --platform=linux/$1 --build-arg TARGETARCH=$1 --build-arg BUILD_TYPE=$2 --build-arg REPO=https://bitbucket.org/chromiumembedded/java-cef.git --build-arg REF=master --file DockerfileLinux --output out .
else
docker buildx build --platform=linux/$1 --build-arg TARGETARCH=$1 --build-arg BUILD_TYPE=$2 --build-arg REF=$3 --file DockerfileLinux --output out .
docker buildx build --platform=linux/$1 --build-arg TARGETARCH=$1 --build-arg BUILD_TYPE=$2 --build-arg REPO=$3 --build-arg REF=$4 --file DockerfileLinux --output out .
fi

View File

@ -7,7 +7,7 @@ echo "Building for architecture $TARGETARCH"
if [ ! -f "/jcef/README.md" ]; then
echo "Did not find existing files to build - cloning..."
rm -rf /jcef
git clone https://bitbucket.org/chromiumembedded/java-cef.git /jcef
git clone ${REPO} /jcef
cd /jcef
git checkout ${REF}
else

80
tools/create_release_info.sh Executable file
View File

@ -0,0 +1,80 @@
#!/bin/bash
if [ ! $# -eq 4 ]
then
echo "Usage: ./create_release_info.sh <gitrepo> <gitref> <actionsurl> <actionsrunnumber>"
echo ""
echo "gitrepo: git repository url to clone"
echo "gitref: the git commit id to pull"
echo "actionsurl: the url pointing to the builder job"
echo "actionsrunnumber: the number of the current build"
exit 1
fi
#Pull from git
git clone $1 jcef
cd jcef
git checkout $2
#Dump git commit id and suspected url
git rev-parse HEAD | cut -c -7 > ../commit_id.txt #Use short 7-digit commit id
(
sed 's/\.git.*$//' <<< "$1" #Remove .git and everything behind from url
echo "/commits/"
git rev-parse HEAD #Add commit id
) | awk '{print}' ORS='' > ../commit_url.txt #Remove newlines and pipe to file
#Dump git commit message
git log -1 --pretty=%B > ../commit_message.txt
#Dump cef version info
(grep -o -P '(?<=CEF_VERSION \").*(?=\")' < CMakeLists.txt) > ../cef_version.txt
#Build final release information
#Tag
(
echo "release_tag_name="
echo "jcef-"
cat ../commit_id.txt
echo "+cef-"
cat ../cef_version.txt
) | awk '{print}' ORS='' >> $GITHUB_ENV
#Name
(
echo "release_name="
echo "JCEF "
cat ../commit_id.txt
echo " + CEF "
cat ../cef_version.txt
) | awk '{print}' ORS='' >> $GITHUB_ENV
#Readme
(
echo "Update JCEF to ["
cat ../commit_id.txt
echo "]("
cat ../commit_url.txt
echo ")"
echo ""
echo "Build: [GitHub Actions #$4]($3)"
echo ""
echo "JCEF version:"
cat ../commit_id.txt
echo ""
echo "CEF version:"
cat ../cef_version.txt
echo ""
echo "Changes from previous release:"
echo "\`\`\`"
cat ../commit_message.txt
echo "\`\`\`"
) > ../release_message.md
#Add LICENSE
mv LICENSE.txt ..
#Cleanup
rm *.txt
cd ..
rm -rf jcef