Nightlies on GitHub (#399)
Rework the nightly actions workflow in order to store nightlies in GitHub. Fixes #397.
This commit is contained in:
parent
7c7662f253
commit
4098d03067
92
.github/workflows/nightly.yml
vendored
92
.github/workflows/nightly.yml
vendored
@ -10,23 +10,39 @@ jobs:
|
||||
|
||||
outputs:
|
||||
status: ${{ steps.check.outputs.status }}
|
||||
version: ${{ steps.check.outputs.version }}
|
||||
upload_url: ${{ steps.create.outputs.upload_url }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/checkout@v2
|
||||
name: checkout
|
||||
|
||||
- run: |
|
||||
ver=$(./bintray_nightly_check.sh)
|
||||
- name: nightly-check
|
||||
id: check
|
||||
shell: bash {0}
|
||||
run: |
|
||||
ver=$(./.github/workflows/nightly_check.sh)
|
||||
echo "::set-output name=status::$?"
|
||||
echo "::set-output name=version::${ver}"
|
||||
|
||||
name: nightly-check
|
||||
id: check
|
||||
shell: bash {0}
|
||||
- name: create-release
|
||||
id: create
|
||||
if: steps.check.outputs.status == 0
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
|
||||
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: nightly-${{ steps.check.outputs.version }}
|
||||
release_name: Nightly build from ${{ steps.check.outputs.version }}
|
||||
prerelease: true
|
||||
commitish: ${{ env.GITHUB_SHA }}
|
||||
|
||||
- name: obs-trigger
|
||||
id: obs
|
||||
if: steps.check.outputs.status == 0
|
||||
run: ./.github/workflows/obs_trigger.sh
|
||||
env:
|
||||
OBS_USER: ${{ secrets.OBS_USER }}
|
||||
OBS_SECRET: ${{ secrets.OBS_SECRET }}
|
||||
|
||||
build-docker:
|
||||
|
||||
@ -41,7 +57,7 @@ jobs:
|
||||
- /workspace:/github/workspace
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/checkout@v2
|
||||
name: checkout
|
||||
|
||||
- run: rm -f bin/.gitkeep
|
||||
@ -55,15 +71,40 @@ jobs:
|
||||
|
||||
- run: ./rebuild_mxe32_with_gui_docker.sh
|
||||
name: build-for-win32
|
||||
|
||||
- run: ./bintray_nightly_upload.sh ${{needs.check.outputs.version}}
|
||||
name: upload-to-bintray-nightly
|
||||
|
||||
- name: Upload Linux Build
|
||||
id: upload-linux
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
|
||||
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
|
||||
OBS_USER: ${{ secrets.OBS_USER }}
|
||||
OBS_SECRET: ${{ secrets.OBS_SECRET }}
|
||||
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.check.outputs.upload_url }}
|
||||
asset_path: ./bin/lnx.zip
|
||||
asset_name: lnx.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Upload Win64 Build
|
||||
id: upload-w64
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.check.outputs.upload_url }}
|
||||
asset_path: ./bin/w64.zip
|
||||
asset_name: w64.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Upload Win32 Build
|
||||
id: upload-w32
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.check.outputs.upload_url }}
|
||||
asset_path: ./bin/w32.zip
|
||||
asset_name: w32.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
build-macos:
|
||||
|
||||
needs: check
|
||||
@ -72,7 +113,7 @@ jobs:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/checkout@v2
|
||||
name: checkout
|
||||
|
||||
- name: Install Qt
|
||||
@ -81,8 +122,13 @@ jobs:
|
||||
- run: ./build_macos_native.sh
|
||||
name: build-for-mac
|
||||
|
||||
- run: ./bintray_nightly_upload.sh ${{needs.check.outputs.version}} ./build/bin/mac.zip mac
|
||||
name: upload-bintray-mac-build
|
||||
- name: Upload Mac Build
|
||||
id: upload-mac
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
|
||||
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.check.outputs.upload_url }}
|
||||
asset_path: ./build/bin/mac.zip
|
||||
asset_name: mac.zip
|
||||
asset_content_type: application/zip
|
||||
|
11
.github/workflows/nightly_check.sh
vendored
Executable file
11
.github/workflows/nightly_check.sh
vendored
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
git describe --tags --contains --match 'nightly-*' >&- 2>&-
|
||||
if [[ $? -eq 0 ]]; then
|
||||
# build not needed : latest 'nightly-*' tag points at HEAD
|
||||
exit 1
|
||||
else
|
||||
# build needed : output the build timestamp and exit 0
|
||||
echo "$(date +%Y-%m-%d-%H-%M-%S)"
|
||||
exit 0
|
||||
fi
|
4
.github/workflows/obs_trigger.sh
vendored
Executable file
4
.github/workflows/obs_trigger.sh
vendored
Executable file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
obs_trigger=$(curl --user $OBS_USER:$OBS_SECRET --write-out %{http_code} --silent --output /dev/null -H 'Accept-Encoding: identity' -H 'User-agent: osc/0.164.2' -H 'Content-type: application/x-www-form-urlencoded' -X POST https://api.opensuse.org/build/home:justdan96?cmd=rebuild&package=tsMuxer)
|
||||
echo $obs_trigger
|
@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Checks if the commit hash of the current newest nightly build on
|
||||
# Bintray is the same as the current HEAD, in which case returns a
|
||||
# nonzero exit code. Otherwise, tries to create a new "version" in the
|
||||
# Bintray repository.
|
||||
|
||||
# This script should be used as the entry point of "build nightly"
|
||||
# actions in order to prevent unnecessarily triggering builds if nothing
|
||||
# has changed.
|
||||
|
||||
# BINTRAY_USER and BINTRAY_API_KEY must be present in the environment.
|
||||
|
||||
version_date=$(date +%Y-%m-%d-%H-%M-%S)
|
||||
|
||||
create_version() {
|
||||
local package_name=$1
|
||||
local vcs_ver=$2
|
||||
|
||||
# create a new version with the timestamp
|
||||
version_data='{ "name": "'
|
||||
version_data+=$version_date
|
||||
version_data+='", "desc": "tsMuxer CLI and GUI binaries built on '
|
||||
version_data+=$version_date
|
||||
version_data+="\", \"vcs_tag\": \"${vcs_ver}\"}"
|
||||
echo >&2 "$version_data"
|
||||
|
||||
version_created=$(curl -u$BINTRAY_USER:$BINTRAY_API_KEY -H "Content-Type: application/json" --write-out %{http_code} --silent --output /dev/null --request POST --data "$version_data" https://api.bintray.com/packages/$BINTRAY_USER/$BINTRAY_REPO/${package_name}/versions)
|
||||
if [[ $version_created -eq 201 ]]; then
|
||||
echo >&2 "version $version_date has been created!"
|
||||
else
|
||||
echo >&2 "error creating version $version_date : server returned $version_created"
|
||||
fi
|
||||
}
|
||||
|
||||
BINTRAY_REPO=tsMuxer
|
||||
PCK_NAME=tsMuxerGUI-Nightly
|
||||
repo_commit=$(curl -u$BINTRAY_USER:$BINTRAY_API_KEY -s https://api.bintray.com/packages/$BINTRAY_USER/$BINTRAY_REPO/$PCK_NAME/versions/_latest | jq -r .vcs_tag)
|
||||
echo >&2 "latest vcs_tag : ${repo_commit}"
|
||||
local_commit=$(git rev-parse HEAD)
|
||||
|
||||
if [[ $repo_commit == $local_commit ]]; then
|
||||
echo >&2 "latest nightly build already in bintray!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
create_version "$PCK_NAME" "$local_commit"
|
||||
echo "$version_date"
|
||||
|
||||
exit 0 # don't return an error in case the version already exists
|
@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# BINTRAY_USER
|
||||
# BINTRAY_API_KEY
|
||||
|
||||
BINTRAY_REPO=tsMuxer
|
||||
PCK_NAME=tsMuxerGUI-Nightly
|
||||
|
||||
upload_to_bintray() {
|
||||
local localpath="$1"
|
||||
local buildname="$2"
|
||||
curl -T "$localpath" "-u$BINTRAY_USER:$BINTRAY_API_KEY" \
|
||||
-H "X-Bintray-Package:$PCK_NAME" \
|
||||
-H "X-Bintray-Version:$version_date" \
|
||||
-H "X-Bintray-Publish:1" \
|
||||
-H "X-Bintray-Override:1" \
|
||||
"https://api.bintray.com/content/$BINTRAY_USER/$BINTRAY_REPO/${buildname}-nightly-$version_date.zip"
|
||||
}
|
||||
|
||||
version_date=$1
|
||||
shift
|
||||
|
||||
# when triggered with arguments, just upload the given file and exit.
|
||||
if [[ "$@" ]]; then
|
||||
upload_to_bintray "$@"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# upload the ZIP files to the version we just created on bintray
|
||||
echo "uploading files..."
|
||||
for buildname in w32 w64 lnx; do
|
||||
upload_to_bintray "./bin/${buildname}.zip" "$buildname"
|
||||
done
|
||||
echo "files uploaded!"
|
||||
|
||||
# try to trigger a new build in OBS
|
||||
obs_trigger=$(curl --user $OBS_USER:$OBS_SECRET --write-out %{http_code} --silent --output /dev/null -H 'Accept-Encoding: identity' -H 'User-agent: osc/0.164.2' -H 'Content-type: application/x-www-form-urlencoded' -X POST https://api.opensuse.org/build/home:justdan96?cmd=rebuild&package=tsMuxer)
|
||||
echo $obs_trigger
|
||||
#if [ $obs_trigger -eq 200 ] ; then
|
||||
# echo "build has been triggered in OBS!"
|
||||
#else
|
||||
# echo "error triggering build in OBS!"
|
||||
# exit 3
|
||||
#fi
|
Loading…
x
Reference in New Issue
Block a user