Build if update is available #3840
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: Build if update is available | |
on: | |
push: | |
paths: | |
- '**.yml' | |
schedule: | |
- cron: '*/600 * * * *' | |
jobs: | |
build: | |
runs-on: windows-2019 | |
steps: | |
- name: Get 'latest' tag from openssl/openssl repo | |
id: latest_tag | |
run: | | |
$url = "https://api.github.com/repos/openssl/openssl/releases/latest" | |
$response = Invoke-RestMethod -Uri $url -Method Get | |
$latest_tag = $response.tag_name | |
Write-Host $latest_tag | |
Write-Host "official_tag=$latest_tag" >> $env:GITHUB_ENV | |
echo "official_tag=$latest_tag" >> $env:GITHUB_ENV | |
shell: powershell | |
- name: Get 'latest' tag from zachariah-george/openssl repo | |
id: latest_tag_unofficial | |
run: | | |
$url = "https://api.github.com/repos/zachariah-george/openssl/releases/latest" | |
$response = Invoke-RestMethod -Uri $url -Method Get | |
$latest_tag_unofficial = $response.tag_name | |
Write-Host $latest_tag_unofficial | |
Write-Host "repo_tag=$latest_tag_unofficial" >> $env:GITHUB_ENV | |
echo "repo_tag=$latest_tag_unofficial" >> $env:GITHUB_ENV | |
shell: powershell | |
- if: env.repo_tag != env.official_tag | |
name: Clone OpenSSL repository | |
run: | | |
git clone git://git.openssl.org/openssl.git | |
# - if: env.repo_tag != env.official_tag | |
# name: Generate release notes | |
# id: generate_release_notes | |
# run: | | |
# cd openssl | |
# git fetch --all --tags | |
# release_notes=$(git log --pretty=format:"- %s ([%h](http://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=%H))" ${{ env.repo_tag }}..${{ env.official_tag }}) | |
# echo "release_notes=$release_notes" >> $GITHUB_ENV | |
# shell: bash | |
# - name: Compare tags | |
# id: compare_tags | |
# run: | | |
# echo "unofficial=$repo_tag" | |
# echo "official=$official_tag" | |
# shell: bash | |
- if: env.repo_tag != env.official_tag | |
name: Check Tags | |
run: echo "This repo is behind official." | |
- if: env.repo_tag != env.official_tag | |
name: Set up MSVC | |
uses: ilammy/msvc-dev-cmd@v1 | |
# uses: TheMrMilchmann/setup-msvc-dev@v3.0.0 | |
# with: | |
# arch: x64 | |
- if: env.repo_tag != env.official_tag | |
name: Set up NASM | |
uses: ilammy/setup-nasm@v1 | |
- if: env.repo_tag != env.official_tag | |
uses: actions/checkout@v4 | |
with: | |
repository: openssl/openssl | |
ref: ${{ env.official_tag }} | |
- if: env.repo_tag != env.official_tag | |
name: Configure OpenSSL | |
run: | | |
perl Configure VC-WIN64A --prefix=C:\openssl | |
- if: env.repo_tag != env.official_tag | |
name: Build OpenSSL | |
run: | | |
nmake | |
nmake test | |
nmake install | |
- if: env.repo_tag != env.official_tag | |
name: Compress OpenSSL | |
run: | | |
Compress-Archive -Path C:\openssl -DestinationPath openssl.zip | |
- if: env.repo_tag != env.official_tag | |
name: Set release name | |
id: set_release_name | |
run: | | |
latest_version="${{ env.official_tag }}" | |
datetime=$(date +"%Y%m%d%H%M%S") | |
version_with_datetime="$latest_version-$datetime" | |
echo "::set-output name=release_name::$latest_version" | |
shell: bash | |
- if: env.repo_tag != env.official_tag | |
name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: '${{ env.official_tag }}' | |
release_name: ${{ env.official_tag }} | |
draft: false | |
prerelease: false | |
# body: ${{ env.release_notes }} | |
- if: env.repo_tag != env.official_tag | |
name: Upload release asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./openssl.zip | |
asset_name: openssl.zip | |
asset_content_type: application/zip |