File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Versioning
2+ on :
3+ push :
4+ # Will not trigger on a release candidate
5+ tags : [ 'v[0-9]+.[0-9]+.[0-9]+' ]
6+
7+ jobs :
8+ versioning :
9+ name : versioning
10+ runs-on : ubuntu-latest
11+ steps :
12+ # Clone the pushed tag
13+ - name : Clone tag
14+ uses : actions/checkout@v4
15+
16+ # Get the tag for the prior version
17+ - name : Get prior version
18+ id : get_tag
19+ run : |
20+ PRIOR_VERSION=$(git tag -l --sort=-v:refname | head -n 1 | sed "s/v//g" | sed "s/\./-/g")
21+ echo "PRIOR_VERSION=$PRIOR_VERSION" >> $GITHUB_ENV
22+ echo "Prior version tag: $PRIOR_VERSION"
23+
24+ # Clone the prior tag
25+ - name : Clone prior branch
26+ uses : actions/checkout@v4
27+ with :
28+ ref : ${{ steps.get_tag.outputs.PRIOR_VERSION }}
29+ path : prior
30+ fetch-depth : 0
31+
32+ # Move latest of the prior tag to corresponding version folder
33+ - name : Move prior latest to versions
34+ shell : bash
35+ run : |
36+ mkdir "content/versions/$PRIOR_VERSION"
37+ cp -r prior/content/latest "content/versions/$PRIOR_VERSION"
38+ rm -r prior
39+
40+ # Commit everything to main
41+ - name : Commit and replace
42+ run : |
43+ git add .
44+ git commit -m "Migrated ${{ github.ref_name }} into latest"
45+ git push origin main
You can’t perform that action at this time.
0 commit comments