Build Development Release #1239
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 Development Release | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 3 * * *' | |
jobs: | |
build-modules: | |
# See: https://help.github.com/en/actions/reference/contexts-and-expression-syntax-for-github-actions#github-context | |
# https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables | |
if: github.repository == 'BimberLab/DiscvrLabKeyModules' | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Find default branch" | |
uses: octokit/[email protected] | |
id: get_default_branch | |
with: | |
route: GET /repos/${{ github.repository }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
- name: "Print default branch" | |
run: | | |
DEFAULT_BRANCH='${{ fromJson(steps.get_default_branch.outputs.data).default_branch }}' | |
echo 'Default branch: '$DEFAULT_BRANCH | |
echo "DEFAULT_BRANCH=${DEFAULT_BRANCH}" >> $GITHUB_ENV | |
id: default-branch | |
- name: "Build DISCVR" | |
if: ${{ env.DEFAULT_BRANCH == github.ref_name }} | |
uses: bimberlabinternal/DevOps/githubActions/discvr-build@master | |
with: | |
artifactory_user: ${{secrets.artifactory_user}} | |
artifactory_password: ${{secrets.artifactory_password}} | |
# NOTE: permissions are limited on the default secrets.GITHUB_TOKEN, including updating workflows, so use a personal access token | |
github_token: ${{ secrets.PAT }} | |
env: | |
GENERATE_DIST: 1 | |
- name: Publish Latest Release | |
id: publish-release | |
if: ${{ env.DEFAULT_BRANCH == github.ref_name && github.event_name == 'push' && github.base_ref == '' }} | |
env: | |
GH_TOKEN: "${{ secrets.PAT }}" | |
run: | | |
LK_VERSION=$(cat /home/runner/work/_temp/_github_home/lkDist/release.txt | sed 's/-SNAPSHOT//g') | |
cd /home/runner/work/_temp/_github_home/labkey_build/${LK_VERSION}/server/server/modules/DiscvrLabKeyModules | |
COUNT=$(gh release list | grep 'latest' | wc -l) | |
if [ $COUNT != '0' ];then gh release delete 'latest' --cleanup-tag -y; fi | |
git push -f origin "latest" | |
gh release create 'latest' --verify-tag --generate-notes --prerelease --title "Development Build: ${{ env.DEFAULT_BRANCH }}" | |
gh release upload 'latest' /home/runner/work/_temp/_github_home/lkDist/discvr/DISCVR-* |