Update build.yml

test push to docker with version
This commit is contained in:
JB
2023-09-28 22:39:57 +01:00
committed by GitHub
parent a3fe5d4729
commit ba6b12a303

View File

@@ -3,16 +3,20 @@ name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
- name: Vet
run: go vet ./...
- name: Test
run: go test -race ./... && echo true
@@ -43,6 +47,16 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- name: Extract Version
id: version_step
run: |
echo "##[set-output name=version;]VERSION=${GITHUB_REF#$"refs/tags/v"}"
echo "##[set-output name=version_tag;]$GITHUB_REPOSITORY:${GITHUB_REF#$"refs/tags/v"}"
echo "##[set-output name=latest_tag;]$GITHUB_REPOSITORY:latest"
- name: Print Version
run: |
echo ${{steps.version_step.outputs.version_tag}}
echo ${{steps.version_step.outputs.latest_tag}}
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Hub
@@ -58,4 +72,8 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/server:latest
tags: |
${{env.VERSION_TAG}}
${{env.LATEST_TAG}}
build-args: |
${{steps.version_step.outputs.version}}