-
Notifications
You must be signed in to change notification settings - Fork 1
executable file
·119 lines (115 loc) · 4.42 KB
/
ci.yaml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: CI
# Triggers the workflow on push or pull request events for any branch that has
# this file
on: [push, pull_request]
# This workflow has only two jobs - testing and building (combined into
# one) and uploading the release to github
jobs:
ci:
name: Test and build on node ${{ matrix.node_version }}
# Run the job on an instance of Ubuntu
runs-on: ubuntu-latest
strategy:
matrix:
# Run on node 14
node_version: ['14.x']
steps:
# `git clone` the repo
- name: Check out repo
uses: actions/checkout@v1
# Setup the specified version of node
- name: Setup node ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}
# Install dependencies and run the `yarn ci` command
- name: Test and build
run: |
yarn
yarn ci
env:
# Variables needed for the tests to run
MICROSOFT_CLIENT_ID: ${{ secrets.MICROSOFT_CLIENT_ID }}
MICROSOFT_CLIENT_SECRET: ${{ secrets.MICROSOFT_CLIENT_SECRET }}
MICROSOFT_REDIRECT_URI: ${{ secrets.MICROSOFT_REDIRECT_URI }}
MICROSOFT_REFRESH_TOKEN: ${{ secrets.MICROSOFT_REFRESH_TOKEN }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
GOOGLE_REDIRECT_URI: ${{ secrets.GOOGLE_REDIRECT_URI }}
GOOGLE_REFRESH_TOKEN: ${{ secrets.GOOGLE_REFRESH_TOKEN }}
# Save the built binaries
- name: Saving alpine binary
uses: actions/upload-artifact@v2
with:
name: files-api-server-alpine
path: dist/binaries/files-api-server-alpine
- name: Saving linux binary
uses: actions/upload-artifact@v2
with:
name: files-api-server-linux
path: dist/binaries/files-api-server-linux
- name: Saving macos binary
uses: actions/upload-artifact@v2
with:
name: files-api-server-macos
path: dist/binaries/files-api-server-macos
- name: Saving windows binary
uses: actions/upload-artifact@v2
with:
name: files-api-server-win.exe
path: dist/binaries/files-api-server-win.exe
# Upload the release
release:
name: Upload release
# Make sure the ci task has succeeded before uploading a release
needs: [ci]
runs-on: ubuntu-latest
steps:
# `git clone` the repo
- name: Check out repo
uses: actions/checkout@v1
# Download built binaries
- name: Downloading alpine binary
uses: actions/download-artifact@v2
with:
name: files-api-server-alpine
- name: Downloading linux binary
uses: actions/download-artifact@v2
with:
name: files-api-server-linux
- name: Downloading macos binary
uses: actions/download-artifact@v2
with:
name: files-api-server-macos
- name: Downloading windows binary
uses: actions/download-artifact@v2
with:
name: files-api-server-win.exe
# Check if the version is different from the last uploaded release
- name: Check version
run: |
revision=`git rev-list --tags --max-count=1`
version_name=`cat version`
previous_version_name=`git describe --tags --abbrev=0`
echo "Uploading version: $version_name"
echo "Previous version: $previous_version_name"
echo "::set-output name=version::$version_name"
echo "::set-output name=previous_version::$previous_version_name"
id: check-version
- name: Create release
# Run it only if the version has been changed
if: ${{ steps.check-version.outputs.version != steps.check-version.outputs.previous_version && github.ref == 'refs/heads/develop' }}
uses: softprops/action-gh-release@v1
with:
body_path: release-notes.md
tag_name: ${{ steps.check-version.outputs.version }}
prerelease: ${{ contains(steps.check-version.outputs.version, '-') }}
name: Dabbu Files API Server ${{ steps.check-version.outputs.version }}
files: |
files-api-server-alpine
files-api-server-linux
files-api-server-macos
files-api-server-win.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: dabbu-knowledge-platform/files-api-server