File tree 2 files changed +122
-0
lines changed
2 files changed +122
-0
lines changed Original file line number Diff line number Diff line change
1
+ on :
2
+ push :
3
+ branches :
4
+ - master
5
+ tags-ignore :
6
+ - ' **'
7
+
8
+ jobs :
9
+ build-and-push :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ - name : Remove unnecessary files
14
+ run : |
15
+ sudo rm -rf /usr/share/dotnet
16
+ sudo rm -rf "$AGENT_TOOLSDIRECTORY"
17
+
18
+ - name : Checkout code
19
+ uses : actions/checkout@v2
20
+
21
+ - name : Login to Docker Hub
22
+ run : echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin docker.io
23
+
24
+ - name : Build and push latest docker image
25
+ run : |
26
+ git clone https://github.com/mpg-age-bioinformatics/software_docker.git
27
+ cd software_docker
28
+ APP_VERSION=$(ls -d v*.*.* | sort -V | tail -n 1)
29
+ cd ${APP_VERSION}
30
+ docker buildx build --platform linux/amd64 -t mpgagebioinformatics/bioinformatics_software:latest . --push
31
+
32
+ - name : Set Success env
33
+ run : echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-8)" >> $GITHUB_ENV
34
+
35
+ - name : Slack Success Notification
36
+ run : |
37
+ generate_post_data()
38
+ {
39
+ cat << EOF
40
+ {
41
+ "text": "Bioinf Software Docker $GITHUB_SHA_SHORT build and push completed"
42
+ }
43
+ EOF
44
+ }
45
+ curl -H "Content-Type: application/json" -X POST -d "$(generate_post_data)" ${{ secrets.SLACK_WEBHOOK }}
46
+
47
+ - name : Set Failure env
48
+ if : failure()
49
+ run : echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-8)" >> $GITHUB_ENV
50
+
51
+ - name : Slack Failure Notification
52
+ if : failure()
53
+ run : |
54
+ generate_post_data()
55
+ {
56
+ cat << EOF
57
+ {
58
+ "text": "Bioinf Software Docker $GITHUB_SHA_SHORT build and push FAILED"
59
+ }
60
+ EOF
61
+ }
62
+ curl -H "Content-Type: application/json" -X POST -d "$(generate_post_data)" ${{ secrets.SLACK_WEBHOOK }}
Original file line number Diff line number Diff line change
1
+ name : Docker Image Push
2
+
3
+ on :
4
+ push :
5
+ tags : [ '*.*.*' ]
6
+
7
+ jobs :
8
+ build-and-push :
9
+ runs-on : ubuntu-latest
10
+
11
+ steps :
12
+ - name : Remove unnecessary files
13
+ run : |
14
+ sudo rm -rf /usr/share/dotnet
15
+ sudo rm -rf "$AGENT_TOOLSDIRECTORY"
16
+
17
+ - name : Checkout code
18
+ uses : actions/checkout@v2
19
+
20
+ - name : Login to Docker Hub
21
+ run : echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin docker.io
22
+
23
+ - name : Build and tag Docker image
24
+ run : |
25
+ APP_VERSION=${GITHUB_REF#refs/*/}
26
+ git clone https://github.com/mpg-age-bioinformatics/software_docker.git
27
+ cd software_docker/${APP_VERSION}
28
+ docker buildx build --platform linux/amd64 -t mpgagebioinformatics/bioinformatics_software:${APP_VERSION} -t mpgagebioinformatics/bioinformatics_software:latest . --push
29
+
30
+ - name : Set Success env
31
+ run : echo "GITHUB_SHA_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
32
+
33
+ - name : Slack Success Notification
34
+ run : |
35
+ generate_post_data()
36
+ {
37
+ cat << EOF
38
+ {
39
+ "text": "Bioinf Software Docker $GITHUB_SHA_SHORT build and push completed"
40
+ }
41
+ EOF
42
+ }
43
+ curl -H "Content-Type: application/json" -X POST -d "$(generate_post_data)" ${{ secrets.SLACK_WEBHOOK }}
44
+
45
+ - name : Set Failure env
46
+ if : failure()
47
+ run : echo "GITHUB_SHA_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
48
+
49
+ - name : Slack Failure Notification
50
+ if : failure()
51
+ run : |
52
+ generate_post_data()
53
+ {
54
+ cat << EOF
55
+ {
56
+ "text": "Bioinf Software Docker $GITHUB_SHA_SHORT build and push FAILED"
57
+ }
58
+ EOF
59
+ }
60
+ curl -H "Content-Type: application/json" -X POST -d "$(generate_post_data)" ${{ secrets.SLACK_WEBHOOK }}
You can’t perform that action at this time.
0 commit comments