-
Notifications
You must be signed in to change notification settings - Fork 44
125 lines (115 loc) · 4.12 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
name: "tidy3d-release"
permissions:
contents: write
on:
push:
tags:
- 'v*.*.*'
jobs:
test-latest-submodules:
runs-on: ubuntu-latest
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
submodules: 'recursive'
# This fetches only a single branch by default, so additional fetch is needed
fetch-depth: 0 # Optionally, set to 0 to fetch all history for all branches and tags
- name: Initialize and update submodule
run: |
git submodule update --init --recursive
- name: Check if submodules are up to date
shell: bash
run: |
NOTEBOOKS_PATH=docs/notebooks
FAQ_PATH=docs/faq
# Checking out Notebooks submodule with the same branch as the main project/develop
echo "Checking $NOTEBOOKS_PATH for updates..."
cd $NOTEBOOKS_PATH
NOTEBOOKS_CURRENT_COMMIT=$(git rev-parse HEAD)
echo $(git fetch --all --verbose)
echo $(git remote get-url origin)
if git show-ref --verify refs/remotes/origin/develop; then
echo "Branch develop exists."
else
echo "::error::Branch develop does not exist on remote."
exit 1
fi
NOTEBOOKS_LATEST_COMMIT=$(git rev-parse refs/remotes/origin/develop)
echo "NOTEBOOKS_LATEST_COMMIT: $NOTEBOOKS_LATEST_COMMIT"
echo "NOTEBOOKS_CURRENT_COMMIT: $NOTEBOOKS_CURRENT_COMMIT"
cd ../..
if [ "$NOTEBOOKS_LATEST_COMMIT" != "$NOTEBOOKS_CURRENT_COMMIT" ]; then
echo "::error ::Submodule $NOTEBOOKS_PATH is not up to date with the develop branch. Please update it."
exit 1
else
echo "Submodule $NOTEBOOKS_PATH is up to date with the develop branch."
fi
# Checking FAQs only on the develop branch.
echo "Checking $FAQ_PATH for updates..."
cd $FAQ_PATH
FAQ_CURRENT_COMMIT=$(git rev-parse HEAD)
echo $(git fetch --all --verbose)
echo $(git remote get-url origin)
FAQ_LATEST_COMMIT=$(git rev-parse refs/remotes/origin/develop)
echo "FAQ_LATEST_COMMIT: $FAQ_LATEST_COMMIT"
echo "FAQ_CURRENT_COMMIT: $FAQ_CURRENT_COMMIT"
cd ../..
if [ "$FAQ_LATEST_COMMIT" != "$FAQ_CURRENT_COMMIT" ]; then
echo "::error ::Submodule $FAQ_PATH is not up to date. Please update it."
exit 1
else
echo "Submodule $FAQ_PATH is up to date."
fi
github-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Exit if any RC release
if: contains(github.ref, 'rc') == false
uses: everlytic/[email protected]
with:
github_token: ${{ secrets.GH_PAT }}
source_ref: ${{ github.ref }}
target_branch: "latest"
commit_message_template: ':tada: RELEASE: Merged {source_ref} into target {target_branch}'
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
pypi-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/setup-python@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel twine build
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m build
python -m twine upload --repository pypi dist/*
sync_to_develop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: "latest"
- name: Exit if any RC release
if: contains(github.ref, 'rc') == false
uses: everlytic/[email protected]
with:
github_token: ${{ secrets.GH_PAT }}
source_ref: "latest"
target_branch: "develop"
commit_message_template: ':tada: RELEASE: Synced latest into develop'