-
-
Notifications
You must be signed in to change notification settings - Fork 426
142 lines (116 loc) · 4.59 KB
/
release.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
# For more information about TARDIS pipelines, please refer to:
#
# https://tardis-sn.github.io/tardis/development/continuous_integration.html
name: release
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch: # manual trigger
defaults:
run:
shell: bash -l {0}
jobs:
pip_tests:
uses: ./.github/workflows/tests.yml
secrets: inherit
with:
pip_git: true
zenodo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: tardis-sn/tardis_zenodo
token: ${{ secrets.BOT_TOKEN }}
- name: Checkout setup_env action
uses: actions/checkout@v4
with:
repository: tardis-sn/tardis
sparse-checkout: |
.github/actions/setup_env/action.yml
sparse-checkout-cone-mode: true
path: tardis
- name: Setup environment
uses: ./tardis/.github/actions/setup_env
with:
os-label: "linux-64"
- name: Dump Secret Key
run: echo "$KEY_SECRET_JSON" > key_secret.json
env:
KEY_SECRET_JSON: ${{ secrets.ZENODO_KEY_SECRET_JSON }}
- name: Run Notebook
run: jupyter nbconvert gather_data.ipynb --to html --execute --ExecutePreprocessor.timeout=6000
- name: Run Notebook (allow errors)
run: jupyter nbconvert gather_data.ipynb --to html --execute --ExecutePreprocessor.timeout=6000 --allow-errors
if: failure()
- uses: actions/upload-artifact@v4
with:
name: zenodo_json
path: .zenodo.json
create:
needs: [pip_tests, zenodo]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install setuptools_scm
run: pip install "setuptools_scm<7" git-cliff==2.6.1
- name: Show current version
run: python .ci-helpers/get_current_version.py
- name: Get next version
run: |
python .ci-helpers/get_next_version.py
echo "NEW_TAG=$(python .ci-helpers/get_next_version.py)" >> $GITHUB_ENV
- name: Initialize release
uses: softprops/action-gh-release@v1
with:
name: TARDIS v${{ env.NEW_TAG }}
tag_name: release-${{ env.NEW_TAG }}
body: "This release has been created automatically by the TARDIS continuous delivery pipeline."
draft: false
- name: Wait for Zenodo to update the latest release
run: sleep 120
- name: Fetch Latest DOI from Zenodo
id: fetch-doi
run: |
CONCEPT_DOI="592480"
# Make the API request for BibTeX format, following redirects
response=$(curl -s -L -H "Accept: application/x-bibtex" "https://zenodo.org/api/records/${CONCEPT_DOI}")
# Extract the full DOI value correctly
doi=$(echo "$response" | grep -oP 'doi\s*=\s*{([^}]+)}' | grep -oP '\{([^}]+)\}' | sed 's/[{}]//g')
# Extract the DOI URL directly from the response
url=$(echo "$response" | grep -oP 'url\s*=\s*{([^}]+)}' | grep -oP '\{([^}]+)\}' | sed 's/[{}]//g')
echo "Extracted DOI: ${doi}"
echo "Extracted URL: ${url}"
# Create DOI badge using the full DOI value
doi_badge="[](${url})"
# Store results in GitHub environment variables
echo "doi_badge=${doi_badge}" >> $GITHUB_ENV
echo "doi_url=${url}" >> $GITHUB_ENV
- name: Generate and process changelog
run: |
CHANGELOG=$(git cliff --config pyproject.toml --unreleased | sed -n '/^## Changelog/,$p' | grep -vE '^(ERROR|WARN)')
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Update release with changelog and DOI
uses: softprops/action-gh-release@v1
with:
tag_name: release-${{ env.NEW_TAG }}
body: |
This release has been created automatically by the TARDIS continuous delivery pipeline.
${{ env.doi_badge }}
${{ env.CHANGELOG }}
A complete list of changes for this release is available at [CHANGELOG.md](https://github.com/tardis-sn/tardis/blob/master/CHANGELOG.md).
files: |
conda-osx-arm64.lock
conda-linux-64.lock
conda-osx-64.lock
conda-lock.yml
fail_on_unmatched_files: false
draft: false