Skip to content

Commit 6a16eb1

Browse files
authored
introduce release pipeline
add run link to VERSION_D.html comment sourceversion script so that future programmers hate me less add tag-release workflow correct old mistakes that were found underway
1 parent 5fb2ccf commit 6a16eb1

File tree

3 files changed

+49
-6
lines changed

3 files changed

+49
-6
lines changed

.github/workflows/docker.yml

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
deploy:
5656
needs: dspace-angular
5757
uses: dataquest-dev/dspace-angular/.github/workflows/deploy.yml@dtq-dev
58+
if: ${{ github.event_name != 'pull_request' }}
5859
with:
5960
INSTANCE: '5'
6061
IMPORT: false

.github/workflows/tag-release.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '**'
7+
8+
env:
9+
IMAGE_BASE_NAME: dataquest/dspace-angular
10+
11+
jobs:
12+
retag-FE-image:
13+
steps:
14+
- name: Login to DockerHub
15+
uses: docker/login-action@v3
16+
with:
17+
username: ${{ secrets.DOCKER_USERNAME }}
18+
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
19+
20+
- name: retag image
21+
run: |
22+
docker pull ${{ env.IMAGE_BASE_NAME }}:${{ github.sha }}
23+
docker tag ${{ env.IMAGE_BASE_NAME }}:${{ github.sha }} ${{ env.IMAGE_BASE_NAME }}:${{ github.ref_name }}
24+
25+
- name: push image
26+
run: docker push ${{ env.IMAGE_BASE_NAME }}:${{ github.ref_name }}
27+

scripts/sourceversion.py

+21-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
11
import subprocess
2+
import sys
23
from datetime import datetime
34

5+
# when next editing this script, please introduce argparse.
6+
# do not forget, it is called in BE by .github\workflows\reusable-docker-build.yml
7+
# argparse must be introduced there.
8+
# that action also calls BE version of this script, which is different (BE: scripts/sourceversion.py).
9+
# It must also cooperate with argparse
10+
11+
# the idea is, that this will be different on each branch, but could be possibly passed by argv/argparse
12+
RELEASE_TAG_BASE='none'
13+
414
if __name__ == '__main__':
515
ts = datetime.now()
6-
print(f"timestamp: {ts}")
16+
# we have html tags, since this script ends up creating VERSION_D.html
17+
print(f"<h4>This info was generated on: <br> <strong> {ts} </strong> </h4>")
718

8-
cmd = 'git log -1 --pretty=format:"%h - %ai"'
9-
print(f">{cmd}")
19+
cmd = 'git log -1 --pretty=format:"<h4>Git hash: <br><strong> %H </strong> <br> Date of commit: <br> <strong> %ai </strong></h4>"'
1020
subprocess.check_call(cmd, shell=True)
1121

12-
cmd = 'git status --porcelain'
13-
print(f">{cmd}:")
14-
subprocess.check_call(cmd, shell=True)
22+
# when adding argparse, this should be a bit more obvious
23+
link = sys.argv[1] + sys.argv[2]
24+
print('<br> <h4>Build run: </h4> <a href="' + link + '"> ' + link + '</a> ')
25+
26+
link = "https://github.com/dataquest-dev/dspace-angular/releases/tag/" \
27+
+ RELEASE_TAG_BASE + "-" + datetime.now().strftime('%Y.%m.') + sys.argv[2]
28+
29+
print('<br> <br> <h4>Release link: </h4><a href="' + link + '"> ' + link + '</a> (if it does not work, then this is not an official release instance) ')

0 commit comments

Comments
 (0)