File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change 1
- name : Version Control
1
+ name : Versioning
2
2
on :
3
3
push :
4
4
tags : [ 'v*.*.*' ]
8
8
name : versioning
9
9
runs-on : ubuntu-latest
10
10
steps :
11
- - name : Copy files to temporary directory
12
- shell : bash
13
- run : |
14
- cp -r content/latest tmp/content/latest
11
+ # Checkout tag being pushed
12
+ - name : Checkout tag
13
+ uses : actions/checkout@v4
15
14
16
15
# This would be better if we had a current version JSON or something somewhere
17
16
- name : Get prior version
17
+ id : get_tag
18
18
run : |
19
19
PRIOR_VERSION=$(git tag -l --sort=-v:refname | head -n 1 | sed "s/v//g" | sed "s/\./-/g")
20
20
echo "PRIOR_VERSION=$PRIOR_VERSION" >> $GITHUB_ENV
21
21
echo "Prior version tag: $PRIOR_VERSION"
22
22
23
+ # Checkout main
23
24
- name : Checkout main branch
24
25
uses : actions/checkout@v4
25
26
with :
26
- ref : main
27
+ ref : ${{ steps.get_tag.outputs.PRIOR_VERSION }}
28
+ path : old
27
29
fetch-depth : 0
28
30
31
+ # Moves the old latest into it's corresponding version folder
29
32
- name : Add current latest to prior version
30
33
shell : bash
31
34
run : |
35
+ cd main
32
36
mkdir "content/versions/$PRIOR_VERSION"
33
37
cp -r content/latest "content/versions/$PRIOR_VERSION"
34
38
39
+ # Replaces latest with the new tag latest content
35
40
- name : Replace latest with tagged latest
36
41
shell : bash
37
42
run : |
38
43
rm -r content/latest/*
39
- cp -r tmp/content/latest content/latest
44
+ cp -r ../content/latest content/latest
45
+
46
+ # Commits changes to main
47
+ - name : Commit and replace
48
+ run : |
49
+ git add .
50
+ git commit -m "Migrated ${{ github.ref_name }} into latest"
51
+ git push origin main
You can’t perform that action at this time.
0 commit comments