-
Notifications
You must be signed in to change notification settings - Fork 299
173 lines (153 loc) · 6.4 KB
/
release_all_files.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Release workflow run
on:
push:
branches: [ 'feature/automated_release' ]
# branches: [ 'master', 'main', 'develop', 'feature/automated_release' ]
# tags: [ 'v*' ]
# pull_request:
# branches: [ 'master', 'main', 'develop' ]
schedule:
- cron: '0 2 * * *' # daily
workflow_dispatch:
inputs:
branch:
description: 'Branch or tag to retrieve the binaries from'
required: false
default: 'master'
jobs:
# release_job:
# uses: ./.github/workflows/release_binaries.yml
# with:
# branch: master
# target: nightly
# get_latest_tag:
# runs-on: ubuntu-latest
# outputs:
# tag: ${{ fromJson(steps.get_latest_release.outputs.data).tag_name }}
# steps:
# - uses: octokit/request-action@v2.x
# id: get_latest_release
# with:
# route: GET /repos/{owner}/{repo}/releases/latest
# owner: coolprop
# repo: coolprop
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - run: "echo latest release id: ${{ fromJson(steps.get_latest_release.outputs.data).id }}"
# - run: "echo latest release tag: ${{ fromJson(steps.get_latest_release.outputs.data).tag_name }}"
set_vars:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.propagate_vars.outputs.branch }}
target: ${{ steps.propagate_vars.outputs.target }}
webdir: ${{ steps.propagate_vars.outputs.webdir }}
steps:
# Start with the branch or tag for the source code
- run: echo "BRANCH=${{ (inputs.branch == '' && 'master') || inputs.branch }}" >> $GITHUB_ENV
# Try to parse the branch as a version number
- run: |
set +e
echo "TARGET=$(echo ${{ env.BRANCH }} | grep -Eo '[0-9]+(\.[0-9]+)*')" >> $GITHUB_ENV
# Check whether we could parse it or not, use branch or nightly otherwise
- if: "${{ env.TARGET == '' }}"
run: echo "TARGET=${{ (env.BRANCH == 'master' && 'nightly') || env.BRANCH }}" >> $GITHUB_ENV
- run: echo "WEBDIR=${{ (env.TARGET == 'nightly' && 'dev') || '.' }}" >> $GITHUB_ENV
- id: propagate_vars
run: |
echo "branch=${{ env.BRANCH }}" >> $GITHUB_OUTPUT
echo "target=${{ env.TARGET }}" >> $GITHUB_OUTPUT
echo "webdir=${{ env.WEBDIR }}" >> $GITHUB_OUTPUT
collect_binaries:
needs: [set_vars]
strategy:
fail-fast: false
matrix:
os: [ubuntu]
workflow: [mathcad_builder.yml, javascript_builder.yml, library_shared.yml, windows_installer.yml, docs_docker-run.yml, libreoffice_builder.yml] # , python_buildwheels.yml]
uses: ./.github/workflows/release_get_artifact.yml
with:
branch: ${{ needs.set_vars.outputs.branch }}
workflow: ${{ matrix.workflow }}
prepare_sources:
needs: [set_vars]
name: Prepare the source code
runs-on: ubuntu-latest
steps:
- name: Fetch the sources
uses: actions/checkout@v3
with:
ref: ${{ needs.set_vars.outputs.branch }}
submodules: 'recursive'
path: source
- name: Update the headers
run: |
pushd source
git reset --hard HEAD
python "dev/generate_headers.py"
find . -iwholename "*/.git*" -prune -exec rm -rf {} \;
popd
zip -rq CoolProp_sources.zip source
mkdir -p binaries/source
mv CoolProp_sources.zip binaries/source/
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: binaries
path: binaries
retention-days: 1
deploy_files:
needs: [set_vars, collect_binaries, prepare_sources]
name: Deploy collected files
runs-on: ubuntu-latest
steps:
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: binaries
path: binaries
- name: Create info files
run: |
echo "CoolProp ${{ needs.set_vars.outputs.target }} binaries" > binaries/README.rst.txt
echo "-------------------------" >> binaries/README.rst.txt
echo -n "Binaries of the \`CoolProp project <http://coolprop.sourceforge.net>\`_ " >> binaries/README.rst.txt
echo "updated on $(date +%F) at $(date +%X) $(date +%Z)." >> binaries/README.rst.txt
cat binaries/README.rst.txt
mkdir -p binaries/Python
echo "Please use the following commands to install CoolProp for Python:" > binaries/Python/README.txt
echo "nightly: python -m pip install -i https://test.pypi.org/simple/ CoolProp" >> binaries/Python/README.txt
echo "release: python -m pip install --upgrade CoolProp" >> binaries/Python/README.txt
cat binaries/Python/README.txt
- name: Display structure of downloaded files
run: |
set -x
ls -R
du -sh
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SF_SSH_KEY }}
name: id_rsa-${{ secrets.SF_SSH_USER }}
known_hosts: ${{ secrets.SF_HOST_KEYS }}
config: |
Host frs.sf.net-${{ secrets.SF_SSH_USER }}
HostName frs.sf.net
User ${{ secrets.SF_SSH_USER }}
IdentityFile ~/.ssh/id_rsa-${{ secrets.SF_SSH_USER }}
PubkeyAcceptedKeyTypes +ssh-rsa
if_key_exists: fail # replace / ignore / fail; optional (defaults to fail)
- name: Fix the docs
run: |
rm -rf binaries/github-pages
tar -xzf binaries/docs/*documentation*.tar.gz
mkdir -p html/v4
rsync frs.sf.net-${{ secrets.SF_SSH_USER }}:/home/frs/project/coolprop/CoolProp/4.2.5/coolpropv425docs.zip coolpropv4docs.zip
unzip -qo coolpropv4docs.zip -d html/v4
zip -rq documentation.zip html
rm -rf binaries/docs/*
mv documentation.zip binaries/docs/
- name: Upload using rsync over SSH
run: |
RSYNC_DRY_RUN=
RSYNC_OPTS="-a --chmod=Dug=rwx,Do=rx,Fug=rw,Fo=r -z --stats --delete"
rsync $RSYNC_DRY_RUN $RSYNC_OPTS "binaries/" frs.sf.net-${{ secrets.SF_SSH_USER }}:/home/frs/project/coolprop/CoolProp/${{ needs.set_vars.outputs.target }}
rsync $RSYNC_DRY_RUN $RSYNC_OPTS "html/" frs.sf.net-${{ secrets.SF_SSH_USER }}:/home/project-web/coolprop/htdocs/${{ needs.set_vars.outputs.webdir }}