fix: empty version

This commit is contained in:
xjasonlyu
2020-11-08 11:37:35 +08:00
parent ca7d161f58
commit 8c7075050c
4 changed files with 18 additions and 10 deletions
+11 -5
View File
@@ -19,12 +19,18 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
- name: Login to DockerHub
uses: docker/login-action@v1
@@ -33,16 +39,16 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get Version
id: version
uses: oprypin/find-latest-tag@v1
with:
repository: xjasonlyu/tun2socks
id: shell
run: |
echo ::set-output name=version::$(git describe --tags --abbrev=0)
- name: Build and Push
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
xjasonlyu/tun2socks:latest
xjasonlyu/tun2socks:${{ steps.version.outputs.tag }}
xjasonlyu/tun2socks:${{ steps.shell.outputs.version }}
+2
View File
@@ -25,6 +25,8 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache go module
uses: actions/cache@v2
+4 -4
View File
@@ -1,17 +1,17 @@
FROM golang:alpine AS builder
WORKDIR /app
COPY . /app
WORKDIR /tun2socks-src
COPY . /tun2socks-src
RUN apk add --no-cache make git \
&& go mod download \
&& make docker \
&& /app/bin/tun2socks-docker -v
&& mv ./bin/tun2socks-docker /tun2socks
FROM alpine:latest
COPY ./scripts/entrypoint.sh /entrypoint.sh
COPY --from=builder /app/bin/tun2socks-docker /usr/bin/tun2socks
COPY --from=builder /tun2socks /usr/bin/tun2socks
RUN apk add --update --no-cache iptables iproute2 \
&& chmod +x /entrypoint.sh
+1 -1
View File
@@ -4,7 +4,7 @@ NAME = "tun2socks"
TAGS = ""
BUILD_FLAGS = "-v"
VERSION = $(shell git describe --tags --abbrev=0)
VERSION = $(shell git describe --tags --abbrev=0 || echo "unknown version")
BUILD_TIME = $(shell date -u '+%FT%TZ')
LDFLAGS += -w -s -buildid=