@@ -5,10 +5,8 @@ name: Build and Push Docker Image
55# It will run every time you push to the 'main' branch.
66on :
77 push :
8- branches :
9- - " main"
10- - " fix-viewing-keys"
11-
8+ tags :
9+ - " v[0-9]+.[0-9]+.[0-9]+"
1210
1311# This section defines the jobs to be run.
1412jobs :
@@ -18,20 +16,33 @@ jobs:
1816 # This solves your slow build problem!
1917 runs-on : ubuntu-latest
2018
19+ permissions :
20+ contents : read
21+ packages : write
22+
23+ env :
24+ REGISTRY : ghcr.io
25+ IMAGE_NAME : scrtlabs/secret-trading-agent-app
26+
2127 # These are the individual steps the job will perform in order.
2228 steps :
2329 # Step 1: Check out your repository's code
2430 # This downloads your code (including your Dockerfile) onto the server.
2531 - name : Checkout repository
2632 uses : actions/checkout@v4
2733
34+ - name : Get the version
35+ id : get_version
36+ run : echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
37+
2838 # Step 2: Log in to Docker Hub
2939 # This uses the secure secrets you created earlier.
30- - name : Log in to Docker Hub
40+ - name : Login to the Container registry
3141 uses : docker/login-action@v3
3242 with :
33- username : ${{ secrets.DOCKERHUB_USERNAME }}
34- password : ${{ secrets.DOCKERHUB_TOKEN }}
43+ registry : ${{ env.REGISTRY }}
44+ username : ${{ github.actor }}
45+ password : ${{ secrets.GITHUB_TOKEN }}
3546
3647 # Step 3: Build the Docker image and push it to Docker Hub
3748 # This is the main event. It runs the 'docker build' and 'docker push' commands.
4455 push : true
4556 # This sets the tags for your image. We'll use your image name.
4657 # It's good practice to tag with 'latest' and also a unique identifier.
47- tags : zenopie/aqua-chat:latest
58+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get_version.outputs.VERSION }}
4859 build-args : |
4960 NEXT_PUBLIC_API_BASE_URL=
50- LCD_URL=https://lcd.erth.network
61+ LCD_URL=https://lcd.erth.network
0 commit comments