Release last WebRTC milestone #674
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: Release last WebRTC milestone | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
env: | |
current_release_milestone: | |
current_release_branch: | |
next_release_milestone: | |
next_release_branch: | |
should_build: ${{ false }} | |
next_release_tag: | |
next_release_name: | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Maximize build space | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
df -h | |
- uses: actions/checkout@v2 | |
- name: GH Auth | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} >> token.txt | |
gh auth login --with-token < token.txt | |
rm token.txt | |
- name: Getting WebRTC release | |
run: | | |
IFS=$'.' current_release_tag=($(gh api repos/${{ github.repository }}/releases | jq -r ".[0].tag_name")) | |
milestones=$( curl -sL "https://chromiumdash.appspot.com/fetch_milestones" | jq -r 'map(select(.schedule_phase | . != null) | select(.schedule_phase=="stable" or .schedule_phase=="stable_cut"))' ) | |
echo "current_release_milestone=${current_release_tag[0]:-0}" >> $GITHUB_ENV | |
echo "current_release_branch=${current_release_tag[1]:-0}" >> $GITHUB_ENV | |
echo "next_release_milestone=$(echo $milestones | jq -r ".[0].milestone")" >> $GITHUB_ENV | |
echo "next_release_branch=$(echo $milestones | jq -r ".[0].webrtc_branch")" >> $GITHUB_ENV | |
- name: Setup enviroment | |
run: | | |
echo "should_build=${{ env.next_release_branch > env.current_release_branch }}" >> $GITHUB_ENV | |
echo "next_release_name=M${{ env.next_release_milestone }}" >> $GITHUB_ENV | |
echo "next_release_tag=${{ env.next_release_milestone }}.${{ env.next_release_branch }}.0" >> $GITHUB_ENV | |
- name: Create branch | |
if: env.should_build == 'true' | |
run: | | |
git config --local user.email "${{ github.actor }}[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git branch M${{ env.next_release_milestone }} -f | |
git checkout M${{ env.next_release_milestone }} | |
remote_repo="https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" | |
git push "${remote_repo}" "M${{ env.next_release_milestone }}" --force --follow-tags --tags | |
- name: Checkout WebRTC | |
if: env.should_build == 'true' | |
run: | | |
source "${GITHUB_WORKSPACE}/scripts/checkout_webrtc.sh"; | |
echo "${PATH}" >> $GITHUB_PATH | |
echo ::set-output name=should_build::false | |
env: | |
WEBRTC_BRANCH: ${{ env.next_release_branch }} | |
- name: Build WebRTC | |
if: env.should_build == 'true' | |
run: | | |
cd src | |
source "${GITHUB_WORKSPACE}/scripts/build_webrtc.sh" | |
- name: Create SDK | |
if: env.should_build == 'true' | |
run: | | |
mv ./src/libwebrtc.aar . | |
- name: commit and push | |
if: env.should_build == 'true' | |
run: | | |
git tag "${{ env.next_release_tag }}" | |
remote_repo="https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" | |
git push "${remote_repo}" "M${{ env.next_release_milestone }}" --force --follow-tags --tags | |
- name: Create prerelease | |
if: env.should_build == 'true' | |
run: | | |
echo "Release notes: N/A\nWebRTC Branch: [branch-heads/${{ env.next_release_branch }}](https://chromium.googlesource.com/external/webrtc/+log/branch-heads/${{ env.next_release_branch }})" >> changelog.md | |
gh release create "${{ env.next_release_tag }}" -d -t "M${{ env.next_release_milestone }}" -F changelog.md "libwebrtc.aar" | |
# - name: Open PR | |
# if: env.should_build == 'true' | |
# run: gh pr create -f --head "M${{ env.next_release_milestone }}" |