|
| 1 | +name: OpenSSL update |
| 2 | +on: |
| 3 | +schedule: |
| 4 | +# Run once a week at 00:05 AM UTC on Sunday. |
| 5 | + - cron: 5 0 * * 0 |
| 6 | + |
| 7 | +workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | +contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | +openssl-update: |
| 14 | +if: github.repository == 'nodejs/node' |
| 15 | +runs-on: ubuntu-latest |
| 16 | +steps: |
| 17 | + - uses: actions/checkout@v3 |
| 18 | +with: |
| 19 | +persist-credentials: false |
| 20 | + - name: Check if update branch already exists |
| 21 | +run: | |
| 22 | + BRANCH_EXISTS=$(git ls-remote --heads origin actions/tools-update-openssl) |
| 23 | + echo "BRANCH_EXISTS=$BRANCH_EXISTS" >> $GITHUB_ENV |
| 24 | + - name: Check and download new OpenSSL version |
| 25 | +# Only run rest of the workflow if the update branch does not yet exist |
| 26 | +if: ${{ env.BRANCH_EXISTS == '' }} |
| 27 | +run: | |
| 28 | + NEW_VERSION=$(gh api repos/quictls/openssl/releases -q '.[].tag_name|select(contains("openssl-3"))|ltrimstr("openssl-")' | head -n1) |
| 29 | + NEW_VERSION_NO_RELEASE_1=$(case $NEW_VERSION in *quic1) echo ${NEW_VERSION%1};; *) echo $NEW_VERSION;; esac) |
| 30 | + VERSION_H="./deps/openssl/config/archs/linux-x86_64/asm/include/openssl/opensslv.h" |
| 31 | + CURRENT_VERSION=$(grep "OPENSSL_FULL_VERSION_STR" $VERSION_H | sed -n "s/^.*VERSION_STR \"\(.*\)\"/\1/p" | sed 's/+/-/g') |
| 32 | + echo "comparing current version: $CURRENT_VERSION with $NEW_VERSION_NO_RELEASE_1" |
| 33 | + if [ "$NEW_VERSION_NO_RELEASE_1" != "$CURRENT_VERSION" ]; then |
| 34 | + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV |
| 35 | + echo "HAS_UPDATE=true" >> $GITHUB_ENV |
| 36 | + ./tools/dep_updaters/update-openssl.sh download "$NEW_VERSION" |
| 37 | + fi |
| 38 | +env: |
| 39 | +GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} |
| 40 | + - name: Create PR with first commit |
| 41 | +if: env.HAS_UPDATE |
| 42 | +uses: gr2m/create-or-update-pull-request-action@v1 |
| 43 | +# Creates a PR with the new OpenSSL source code committed |
| 44 | +env: |
| 45 | +GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} |
| 46 | +with: |
| 47 | +author: Node.js GitHub Bot <github-bot@iojs.org> |
| 48 | +body: This is an automated update of OpenSSL to ${{ env.NEW_VERSION }}. |
| 49 | +branch: actions/tools-update-openssl # Custom branch *just* for this Action. |
| 50 | +commit-message: 'deps: upgrade openssl sources to quictls/openssl-${{ env.NEW_VERSION }}' |
| 51 | +labels: dependencies |
| 52 | +title: 'deps: update OpenSSL to ${{ env.NEW_VERSION }}' |
| 53 | +path: deps/openssl |
| 54 | + - name: Regenerate platform specific files |
| 55 | +if: env.HAS_UPDATE |
| 56 | +run: | |
| 57 | + sudo apt install -y nasm libtext-template-perl |
| 58 | + ./tools/dep_updaters/update-openssl.sh regenerate |
| 59 | +env: |
| 60 | +GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} |
| 61 | + - name: Add second commit |
| 62 | +# Adds a second commit to the PR with the generated platform-dependent files |
| 63 | +if: env.HAS_UPDATE |
| 64 | +uses: gr2m/create-or-update-pull-request-action@v1 |
| 65 | +env: |
| 66 | +GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} |
| 67 | +with: |
| 68 | +author: Node.js GitHub Bot <github-bot@iojs.org> |
| 69 | +branch: actions/tools-update-openssl # Custom branch *just* for this Action. |
| 70 | +commit-message: 'deps: update archs files for openssl-${{ env.NEW_VERSION }}' |
| 71 | +path: deps/openssl |
0 commit comments