Skip to content

Commit 4f4f5c0

Browse files
committed
git actions
1 parent 38ef687 commit 4f4f5c0

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/docker.tag.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: tag
2+
3+
on:
4+
push:
5+
tags: [ '*.*' ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Build the Docker image
13+
run: |
14+
echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin docker.io
15+
VERSION=${GITHUB_REF#refs/tags/}
16+
docker buildx create --name mybuilder --driver docker-container --bootstrap --use
17+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
18+
docker buildx build --platform linux/amd64,linux/arm64 --no-cache \
19+
-t docker.io/mpgagebioinformatics/mcs_bead_proj:stable \
20+
-t docker.io/mpgagebioinformatics/mcs_bead_proj:${VERSION} \
21+
-t docker.io/mpgagebioinformatics/mcs_bead_proj:latest --push .
22+
23+
- name: Set Success env
24+
run: echo "GITHUB_SHA_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
25+
- name: Slack Success Notification
26+
run: |
27+
generate_post_data()
28+
{
29+
cat << EOF
30+
{
31+
"text": "Microscopy Bead Project $GITHUB_SHA_SHORT build and push completed"
32+
}
33+
EOF
34+
}
35+
curl -H "Content-Type: application/json" -X POST -d "$(generate_post_data)" ${{ secrets.SLACK_WEBHOOK }}
36+
- name: Set Failure env
37+
if: failure()
38+
run: echo "GITHUB_SHA_SHORT=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
39+
- name: Slack Failure Notification
40+
if: failure()
41+
run: |
42+
generate_post_data()
43+
{
44+
cat << EOF
45+
{
46+
"text": "Microscopy Bead Project $GITHUB_SHA_SHORT build and push FAILED"
47+
}
48+
EOF
49+
}
50+
curl -H "Content-Type: application/json" -X POST -d "$(generate_post_data)" ${{ secrets.SLACK_WEBHOOK }}

0 commit comments

Comments
 (0)