mirror of
https://github.com/dcarrillo/whatismyip.git
synced 2024-09-27 22:42:39 +00:00
55 lines
1.2 KiB
YAML
55 lines
1.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- '*'
|
|
pull_request:
|
|
|
|
jobs:
|
|
tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: install go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.17
|
|
|
|
- name: Lint
|
|
run: make lint
|
|
|
|
- name: Tests
|
|
run: make test
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: tests
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
|
|
strategy:
|
|
matrix:
|
|
goos: [linux]
|
|
goarch: [amd64]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set env
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
- name: Sign in to dockerhub
|
|
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
|
|
|
- name: Deploy image
|
|
run: make docker-push VERSION=$RELEASE_VERSION
|
|
|
|
- uses: wangyoucao577/go-release-action@v1.20
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
goos: ${{ matrix.goos }}
|
|
goarch: ${{ matrix.goarch }}
|
|
build_command: make build VERSION=$RELEASE_VERSION
|
|
extra_files: LICENSE README.md
|