|
| 1 | +name: Build and deploy bearssl |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + environment: deploy |
| 15 | + steps: |
| 16 | + - uses: actions/setup-python@v5 |
| 17 | + with: |
| 18 | + python-version: '3.x' |
| 19 | + |
| 20 | + - uses: actions/cache@v4 |
| 21 | + with: |
| 22 | + path: | |
| 23 | + esp8266/tools/dist |
| 24 | + esp8266/tools/sdk/ssl/bearssl/ |
| 25 | + key: ${{ runner.os }}-deploy-${{ hashFiles('.gitmodules', 'esp8266/package/package_esp8266com_index.template.json') }} |
| 26 | + |
| 27 | + - name: Fetch ESP8266 Core |
| 28 | + uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + path: esp8266 |
| 31 | + repository: esp8266/Arduino |
| 32 | + fetch-depth: 1 |
| 33 | + submodules: false |
| 34 | + |
| 35 | + - name: Initialize deploy tools |
| 36 | + run: | |
| 37 | + mkdir ${HOME}/.ssh |
| 38 | +
|
| 39 | + echo "${{ secrets.SSH_DEPLOY_KEY }}" > ${HOME}/.ssh/deploy_key |
| 40 | + chmod 600 ~/.ssh/deploy_key |
| 41 | +
|
| 42 | + echo -ne "Host github.com\n\tHostname github.com\n\tIdentityFile ~/.ssh/deploy_key\n" > \ |
| 43 | + ${HOME}/.ssh/config |
| 44 | +
|
| 45 | + pushd esp8266 |
| 46 | + git config user.name "Maxim Prokhorov (CI)" |
| 47 | + git config user.email "[email protected]" |
| 48 | + popd |
| 49 | +
|
| 50 | + - name: Initialize build environment |
| 51 | + run: | |
| 52 | + pushd esp8266/tools |
| 53 | + python get.py -q |
| 54 | + popd |
| 55 | +
|
| 56 | + - name: Prepare bearssl builder |
| 57 | + run: | |
| 58 | + pushd esp8266 |
| 59 | + git remote add deploy [email protected]:${{ github.repository }}.git |
| 60 | + git switch -c bearssl-rebuild |
| 61 | + git submodule update --init -- tools/sdk/ssl/bearssl |
| 62 | + git submodule update --remote --merge -- tools/sdk/ssl/bearssl |
| 63 | + git add -u |
| 64 | + git commit -m 'Update bearssl builder' |
| 65 | + popd |
| 66 | +
|
| 67 | + - name: Build |
| 68 | + id: build |
| 69 | + run: | |
| 70 | + pushd esp8266 |
| 71 | +
|
| 72 | + pushd tools/sdk/ssl/bearssl |
| 73 | + make clean |
| 74 | + make CONF=esp8266 |
| 75 | + cp esp8266/libbearssl.a ../../lib/ |
| 76 | + popd |
| 77 | +
|
| 78 | + if [[ -n $(git diff --exit-code -- tools/sdk/lib/) ]]; then |
| 79 | + echo "deploy=true" >> "$GITHUB_OUTPUT" |
| 80 | + fi |
| 81 | +
|
| 82 | + popd |
| 83 | +
|
| 84 | + - name: Deploy |
| 85 | + if: steps.build.outputs.deploy == "true" |
| 86 | + run: | |
| 87 | + pushd esp8266 |
| 88 | +
|
| 89 | + git add -u -- tools/sdk/lib/ |
| 90 | + git diff --cached --exit-code || echo " |
| 91 | + git commit -m 'Rebuild bearssl libs' |
| 92 | +
|
| 93 | + branch=$(date -Im | tr '[:punct:]' '_') |
| 94 | + git push deploy bearssl-rebuild:bearssl/build-${branch} |
| 95 | +
|
| 96 | + popd esp8266 |
0 commit comments