Files
go-admin/.github/workflows/go.yml
T
2021-09-07 11:20:55 +08:00

45 lines
1.1 KiB
YAML

name: build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
run: |
ref=${{ github.ref }}
go mod vendor
docker build . -t goadminteam/go-admin:${ref##*/}-${{ github.sha }}
docker tag goadminteam/go-admin:${ref##*/}-${{ github.sha }} goadminteam/go-admin:latest
- uses: Azure/docker-login@v1
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
ref=${{ github.ref }}
docker push goadminteam/go-admin:${ref##*/}-${{ github.sha }}
docker push goadminteam/go-admin:latest