forked from brimdata/zui
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (67 loc) · 2.94 KB
/
linux-release-candidate.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
60
61
62
63
64
65
66
67
68
69
name: Brim linux release candidate creation
on:
push:
branches:
- rc-v*
schedule:
- cron: "5 8 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Extract branch name
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: install rpm
run: sudo apt-get install -y rpm
- uses: actions/setup-go@v2
with:
go-version: "1.16"
- uses: actions/setup-node@v2
with:
cache: yarn
node-version-file: .nvmrc
- if: ${{ !startsWith(steps.extract_branch.outputs.branch, 'rc-v') }}
name: Set version string for ad hoc builds
run: echo "ADHOC_VERSION_STRING=$(npm version preminor --no-git-tag-version --preid prerelease-${GITHUB_SHA:0:8})" >> $GITHUB_ENV
- run: yarn --inline-builds
- run: yarn run build
- name: build packages
run: yarn electron-builder --linux
- name: Setup Google Cloud Platform
uses: google-github-actions/setup-gcloud@master
with:
version: "290.0.1"
project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
service_account_key: ${{ secrets.GCLOUD_CREDENTIAL_RELEASES }}
- if: ${{ startsWith(steps.extract_branch.outputs.branch, 'rc-v') }}
name: "Set bucket path (if this is a release candidate)"
run: echo "BUCKET_PATH=gs://${{ secrets.GCLOUD_BUCKET_RELEASES }}/brim/${{ steps.extract_branch.outputs.branch }}/linux" >> $GITHUB_ENV
- if: ${{ !startsWith(steps.extract_branch.outputs.branch, 'rc-v') }}
name: "Set bucket path (if this is an ad hoc build)"
run: echo "BUCKET_PATH=gs://${{ secrets.GCLOUD_BUCKET_RELEASES }}/brim/${{ env.ADHOC_VERSION_STRING }}/linux" >> $GITHUB_ENV
- name: "Set publicly-available bucket path"
run: echo "PUBLIC_BUCKET_PATH=${BUCKET_PATH/gs:\/\//https://storage.googleapis.com/}" >> $GITHUB_ENV
- name: Upload release artifacts to Google Cloud Storage bucket
run: |
gsutil rm -rf ${{ env.BUCKET_PATH }} || true
gsutil cp dist/installers/Brim-* ${{ env.BUCKET_PATH }}
- name: Assemble Slack message that points to multiple artifacts
run: |
echo "SLACK_TEXT<<EOF" >> $GITHUB_ENV
echo "New Linux release available -" >> $GITHUB_ENV
for FILENAME in $(find dist/installers -type f -name Brim-\* -exec basename {} \;)
do
echo "\n<${{ env.PUBLIC_BUCKET_PATH }}/$FILENAME|${{ env.BUCKET_PATH }}/$FILENAME>" >> $GITHUB_ENV
done
echo "EOF" >> $GITHUB_ENV
- name: Inform Slack users at Brim HQ of the new artifact
uses: tiloio/slack-webhook-action@v1.1.2
with:
slack_web_hook_url: ${{ secrets.SLACK_WEBHOOK_BRIMLABS_RELEASES }}
slack_json: '{
"username": "release-automation",
"text": "${{ env.SLACK_TEXT }}"
}'