Skip to content

v1.9.0

v1.9.0 #27

Workflow file for this run

name: Release Container
on:
release:
types: [ published ]
env:
REGISTRY: ghcr.io
TCR_REGISTRY: ccr.ccs.tencentyun.com
IMAGE_NAME: ${{ github.repository }}
jobs:
build_and_deploy:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ~1.20
- run: |
go mod tidy
go build -o dist/main
env:
CGO_ENABLED: 0
GO111MODULE: on
GOARCH: amd64
GOOS: linux
- name: Login GitHub Container Hub
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login TCR
uses: docker/login-action@v1
with:
registry: ${{ env.TCR_REGISTRY }}
username: ${{ secrets.TCR_USERNAME }}
password: ${{ secrets.TCR_PASSWORD }}
- name: Get Metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Copy to QCLOUD TCR
uses: akhilerm/tag-push-action@v2.0.0
with:
src: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{steps.meta.outputs.version}}
dst: |
${{ env.TCR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.TCR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{steps.meta.outputs.version}}