test CI 2 #4506
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 packages for Windows | |
on: | |
push: | |
pull_request: | |
release: | |
types: | |
- published | |
jobs: | |
build_windows_packages: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: git submodule update --init --recursive | |
- name: Configure | |
run: cmake -B build | |
make_flags+= " -DNNG_ENABLE_SQLITE=ON " | |
make_flags+= " -DNNG_ENABLE_RULE_ENGINE=ON " | |
make_flags+= " -DNNG_ENABLE_JWT=ON " | |
make_flags+= " -DNNG_ENABLE_ZMQ_GATEWAY=ON " | |
make_flags+= " -DNNG_ENABLE_BENCH=ON " | |
echo "make_flags=${make_flags}" >>GITHUB_OUTPUT | |
- name: Build | |
run: cmake ${{ steps.configure.make_flags }} --build build --config Release --target install | |
- name: Package | |
if: github.event_name == 'release' | |
run: | | |
$pkg_name="nanomq-${{ github.event.release.tag_name }}-windows-x86_64.zip" | |
Compress-Archive -Path install/* -DestinationPath $pkg_name | |
mv $pkg_name ./install/ | |
- uses: actions/upload-artifact@v3 | |
if: github.event_name == 'release' | |
with: | |
name: nanomq-${{ github.event.release.tag_name }}-windows-x86_64.zip | |
path: "install/*.zip" | |
- uses: svenstaro/upload-release-action@v2 | |
if: github.event_name == 'release' | |
with: | |
repo_token: ${{ github.token }} | |
file: install/nanomq*.zip | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true | |
- name: upload to aws s3 | |
if: github.event_name == 'release' | |
run: | | |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws configure set default.region us-west-2 | |
aws s3 cp install/ s3://packages.emqx/nanomq/$(git describe --abbrev=0 --tags)/ --recursive --exclude "*" --include "nanomq*.zip" | |
- name: update nanomq.io | |
if: github.event_name == 'release' | |
run: | | |
try { | |
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" | |
$headers.Add("token", "${{ secrets.EMQX_IO_TOKEN }}") | |
$headers.Add("Content-Type", "application/json") | |
$body = "{`"repo`": `"nanomq/nanomq`", `"tag`": `"${{ github.ref_name }}`"}" | |
$response = Invoke-WebRequest ${{ secrets.EMQX_IO_RELEASE_API }} -Method 'POST' -Headers $headers -Body $body | |
if ($response.StatusCode -eq 200) { | |
Write-Host "HTTP status code: $($response.StatusCode)" | |
Write-Host "Success" | |
} else { | |
Write-Host "HTTP status code: $($response.StatusCode)" | |
Write-Host "Response: $($response.Content)" | |
exit 1 | |
} | |
} catch { | |
Write-Host "An error occurred: $($_.Exception.Message)" | |
exit 1 | |
} |