Skip to content

v1.3.6

v1.3.6 #34

Workflow file for this run

name: Publish Docker image
on:
workflow_dispatch:
release:
types: [ published ]
jobs:
build:
name: Build Golang Project
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: './go.mod'
- name: Install dependencies
run: go mod download
- name: Build
run: CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o aries ./main.go
- name: Upload binary file
uses: actions/upload-artifact@v3
with:
name: aries-artifact
path: ./aries
push_to_registry:
name: Push Docker image to Docker Hub and ACR
runs-on: ubuntu-latest
needs: build
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Download binary file
uses: actions/download-artifact@v3
with:
name: aries-artifact
path: ./
# - name: Log in to Docker Hub
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
# with:
# images: zhaoyangkun/aries
#
# - name: Build and push Docker image to Dockerhub
# uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
# with:
# context: .
# push: true
# tags: zhaoyangkun/aries
# labels: "latest"
- name: Build the Docker image
run: |
chmod +x aries
docker build -t zhaoyangkun/aries:latest .
- name: Push Docker image to Docker Hub
run: |
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}
docker push zhaoyangkun/aries:latest
- name: Push Docker image to ACR
run: |
docker login --username=${{ secrets.ACR_USERNAME }} --password=${{ secrets.ACR_PASSWORD }} registry.cn-hangzhou.aliyuncs.com
docker tag zhaoyangkun/aries:latest registry.cn-hangzhou.aliyuncs.com/zhaoyangkun/aries:latest
docker push registry.cn-hangzhou.aliyuncs.com/zhaoyangkun/aries:latest