-
-
Notifications
You must be signed in to change notification settings - Fork 39
140 lines (119 loc) · 4.91 KB
/
upload-artifact.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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Publish GitHub release assets (FSDA.mltbx file to be compatible with
# MathWorks FileExchange new 'link your [repo] to GitHub' feature.)
name: Publish FSDA.mltbx to GitHub release assets
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching *, i.e. v1.0 or 18.6.1
# release:
# types:
# - published
env:
# Define a specific version of MATLAB to release the toolbox
MATLAB_RELEASE: R2023a
# We also need a specific version to build the older v3 doc search
MATLAB_RELEASE_DOC_V3: R2021b
jobs:
# # This job will specifically build the doc search db in 21b which is needed for pre-22a versions of MATLAB
# build-docsearch-v3:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout on your repository
# uses: actions/checkout@v3
# # Sets up MATLAB on the GitHub Actions runner using the older version of MATLAB
# - name: Setup MATLAB
# uses: matlab-actions/setup-matlab@v2-beta
# with:
# release: ${{ env.MATLAB_RELEASE_DOC_V3 }}
# # Runs a set of commands using the runners shell - note that 21b doesn't support
# # 'buildtool' so we use the specific script in a MATLAB run action
# - name: Build docseach db with MATLAB
# uses: matlab-actions/run-command@v1
# with:
# command: "cd('toolbox/utilities_help/build'); buildDocSearchForToolboxPre22a()"
# # Finally keep a copy of the artifacts generated for the next job to download
# - name: Upload helpsearch-v3
# if: ${{ always() }}
# uses: actions/upload-artifact@v3
# with:
# # Artifact key to be used with download-artifact
# name: helpsearch-v3-files
# # A file, directory or wildcard pattern that describes what to upload
# path: helpfiles/pointersHTML/helpsearch-v3/
# This job does the build of the MLTBX file in the MATLAB_RELEASE version of MATLAB
archive-build-artifacts:
# Do not run this job until the previous job is complete
# needs: build-docsearch-v3
runs-on: ubuntu-latest
outputs:
# This output is used by the next job to correctly tag the docker image being built
fsda-release: ${{ steps.extract_tag.outputs.tag }}
steps:
- name: Checkout on your repository
uses: actions/checkout@v3
# - name: Download helpsearch-v3
# if: ${{ always() }}
# uses: actions/download-artifact@v3
# with:
# name: helpsearch-v3-files
# path: helpfiles/pointersHTML/helpsearch-v3/
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
# We are going to start a display server using XVFB to ensure that if the toolbox build
# triggers something that needs a display we have one. This is a done prophylacticly in
# case something one day needs a display.
- name: Start display server
run: |
sudo apt-get install xvfb
Xvfb :99 &
echo "DISPLAY=:99" >> $GITHUB_ENV
- name: Extract tag from this release
id: extract_tag
shell: bash
run: |
echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "GITHUB_RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
# Since this version of MATLAB is likely the same as used in ci.yml if there is a cached version
# use that instead of doing the install.
- name: Cache MATLAB
id: cache-matlab
uses: actions/cache@v3
with:
path: ${{ runner.tool_cache }}/MATLAB
key: ${{ env.MATLAB_RELEASE }}-ubuntu-latest
# Sets up MATLAB on the GitHub Actions runner
- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v2-beta
with:
release: ${{ env.MATLAB_RELEASE }}
# Runs buildtool in the root of the repository, triggering the `toolbox` task
- name: Run MLTBX build
uses: matlab-actions/run-build@v1
with:
tasks: toolbox
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./toolbox/bin/FSDA.mltbx
asset_name: FSDA.mltbx
asset_content_type: application/gzip
build-docker-container:
needs: archive-build-artifacts
uses: ./.github/workflows/reusable-build-docker-container.yml
with:
matlab-release: latest
fsda-release: ${{ needs.archive-build-artifacts.outputs.fsda-release }}
secrets: inherit