add Tag Docker image step #47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | ||
name: ci | ||
on: | ||
push: | ||
branches: [ Workflows ] | ||
jobs: | ||
lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: latest | ||
args: --timeout 5m | ||
test: | ||
name: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.20" | ||
- run: go test -v ./... -covermode=atomic -coverprofile=coverage.out | ||
- uses: codecov/codecov-action@v3 | ||
with: | ||
files: coverage.out | ||
build: | ||
name: build | ||
runs-on: ubuntu-latest | ||
needs: | ||
- lint | ||
- test | ||
strategy: | ||
matrix: | ||
dir: ["", "clients/proxy-client", "clients/harbor-client"] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: docker/setup-qemu-action@v1 | ||
- uses: docker/setup-buildx-action@v1 | ||
- uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Tag Docker image | ||
id: tag | ||
uses: docker/metadata-action@v3 | ||
with: | ||
tags: | | ||
Check failure on line 59 in .github/workflows/ci.yaml GitHub Actions / ciInvalid workflow file
|
||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern=v${{ github.event.release.tag_name }} | ||
type=semver,pattern=v${{ github.event.release.tag_name | split('.')[:2] | join('.') }} | ||
images: ghcr.io/${{ github.repository }}${{ matrix.dir }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
file: "${{ matrix.dir }}/Dockerfile" | ||
context: ${{ matrix.dir }} | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ${{ steps.tag.outputs.tags }} |