-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (115 loc) · 4.94 KB
/
macos-x64.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Macos-x64
on:
schedule:
- cron: '30 2 * * 1'
workflow_dispatch:
inputs:
milestone:
description: 'Milestone to build'
required: true
default: 'last'
jobs:
run-checks:
runs-on: ubuntu-latest
outputs:
new_milestone: ${{ steps.latest_milestone.outputs.new_milestone }}
artifact_present: ${{ steps.check_artifact_release.outputs.artifact_present }}
steps:
- name: Check latest available milestone
id: latest_milestone
run: |
if [[ "${{ github.event.inputs.milestone }}" == "" ]] || [[ "${{ github.event.inputs.milestone }}" == "last" ]]; then
LATEST_MILESTONE=$(curl -s https://chromiumdash.appspot.com/fetch_milestones | jq -r '.[].webrtc_branch | select(. != "" and . != null)' | head -n 1)
echo "Going to build milestone $LATEST_MILESTONE"
echo "::set-output name=new_milestone::$LATEST_MILESTONE"
else
echo "Going to build milestone ${{ github.event.inputs.milestone }}"
echo "::set-output name=new_milestone::${{ github.event.inputs.milestone }}"
fi
- name: Check artifact on release
id: check_artifact_release
run: |
echo "::set-output name=artifact_present::false"
TAG="${{ steps.latest_milestone.outputs.new_milestone }}"
ASSET=$(curl -s https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq ".[] | select(.\"tag_name\"==\"$TAG\") | .\"assets\" | select(.[].\"name\"|test(\"$TAG-mac-x64\"))")
if [[ "$ASSET" != "" ]]; then
echo "::set-output name=artifact_present::true"
echo "Asset for ${{ steps.latest_milestone.outputs.new_milestone }} already uploaded."
fi
build-macos-x64:
needs: run-checks
runs-on: macos-10.15
outputs:
artifact_name: ${{ steps.compile.outputs.artifact_name }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Compile macos-x64
id: compile
if: needs.run-checks.outputs.artifact_present == 'false'
run: |
if [[ "${{ github.event.inputs.milestone }}" == "" ]] || [[ "${{ github.event.inputs.milestone }}" == "last" ]]; then
echo "Building last milestone..."
python build.py --last --cpu x64 --os mac --no-log
else
echo "Building ${{ github.event.inputs.milestone }} milestone..."
python build.py --branch ${{ github.event.inputs.milestone }} --cpu x64 --os mac --no-log
fi
mkdir artifacts
mv *.zip artifacts/
ARTIFACT=$(find artifacts -name "*${{ needs.run-checks.outputs.new_milestone }}-mac-x64*" | awk -F/ '{print $NF}')
echo "::set-output name=artifact_name::$ARTIFACT"
- name: Upload artifact
if: needs.run-checks.outputs.artifact_present == 'false'
uses: actions/upload-artifact@v2
with:
name: ${{ steps.compile.outputs.artifact_name }}
path: artifacts
if-no-files-found: error
release:
needs: [run-checks, build-macos-x64]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check release
id: check_release
run: |
echo "::set-output name=release_present::false"
RELEASE_CODE=$(curl --write-out '%{http_code}' --silent --output /dev/null https://github.com/$GITHUB_REPOSITORY/releases/tag/${{ needs.run-checks.outputs.new_milestone }})
if [[ "$RELEASE_CODE" == "200" ]]; then
echo "::set-output name=release_present::true"
echo "Release ${{ needs.run-checks.outputs.new_milestone }} already created."
fi
- name: Create release
id: create_release
if: steps.check_release.outputs.release_present == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.run-checks.outputs.new_milestone }}
release_name: ${{ needs.run-checks.outputs.new_milestone }}
draft: false
prerelease: false
- name: Download artifacts
id: download_artifacts
if: needs.run-checks.outputs.artifact_present == 'false'
uses: actions/download-artifact@v2
with:
name: ${{ needs.build-macos-x64.outputs.artifact_name }}
path: artifacts
- name: Upload release
id: upload_release_asset
if: needs.run-checks.outputs.artifact_present == 'false'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/${{ needs.build-macos-x64.outputs.artifact_name }}
asset_name: ${{ needs.build-macos-x64.outputs.artifact_name }}
tag: ${{ needs.run-checks.outputs.new_milestone }}
overwrite: true