-
Notifications
You must be signed in to change notification settings - Fork 4
59 lines (54 loc) · 2.57 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Build DISCVR
on:
workflow_dispatch:
push:
branches:
- "*"
tags-ignore:
- latest
pull_request:
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 'Event: ${{ github.event_name }}'
echo 'Repository: ${{ github.repository }}'
echo "DEFAULT_BRANCH=${DEFAULT_BRANCH}" >> $GITHUB_ENV
id: default-branch
- name: "Build DISCVR"
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:
# Only generate the distribution if this is the default branch
GENERATE_DIST: ${{ env.DEFAULT_BRANCH == github.ref_name && '1' || '0' }}
- 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-*