File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Tag Based Image Build
2
+
3
+ on :
4
+ create : # This listens to create events, which includes tag creations
5
+
6
+ jobs :
7
+ buildImageForNewTag :
8
+ if : startsWith(github.ref, 'refs/tags/') # Only run this job when a tag is created
9
+ runs-on : ubuntu-latest
10
+
11
+ steps :
12
+ - name : Checkout code
13
+ uses : actions/checkout@v2
14
+
15
+ - name : Verify tag is on main branch
16
+ run : |
17
+ TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref }})
18
+ MAIN_BRANCH_COMMIT=$(git rev-list -n 1 main)
19
+ if [ "$TAG_COMMIT" != "$MAIN_BRANCH_COMMIT" ]; then
20
+ echo "Tag is not on the main branch, aborting!"
21
+ exit 1
22
+ fi
23
+
24
+ - name : Set up Docker Buildx
25
+ uses : docker/setup-buildx-action@v1
26
+
27
+ - name : Login to DockerHub
28
+ uses : docker/login-action@v1
29
+ with :
30
+ username : ${{ secrets.DOCKER_USERNAME }}
31
+ password : ${{ secrets.DOCKER_PASSWORD }}
32
+
33
+ - name : Build and Push Docker Image
34
+ uses : docker/build-push-action@v2
35
+ with :
36
+ context : .
37
+ target : prod
38
+ platforms : linux/amd64,linux/arm64
39
+ push : true
40
+ tags : thirdweb/web3-api:${{ github.ref_name }} # Set the docker tag to the Git tag name
You can’t perform that action at this time.
0 commit comments