diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b9d067..64b1131 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,31 +1,12 @@ -name: Tag & build +name: Build images on: push: - branches: - - main - paths: - - version.txt + tags: + - 'v[0-9].[0-9]+.[0-9]+**' jobs: - tag: - if: ${{ github.repository == 'llaoj/gcopy' }} - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - run: /usr/bin/git config --global user.email actions@github.com - - run: /usr/bin/git config --global user.name 'GitHub Actions Release Tagger' - - run: hack/release-tag.sh - id: release_tag - outputs: - release_tag: ${{ steps.release_tag.outputs.release_tag }} - build: - needs: tag runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/Makefile b/Makefile index 65bb825..6029c2f 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ VERSION=$(shell cat version.txt) TAG?=$(VERSION) # REGISTRY is the container registry to push into. -REGISTRY?=registry.cn-beijing.aliyuncs.com/llaoj +REGISTRY?=docker.io/llaoj # PKG is the package name of gcopy repo. PKG:=github.com/llaoj/gcopy @@ -30,7 +30,7 @@ GOARCH ?= amd64 version: @echo $(VERSION) - cd frontend && npm version $(VERSION) && npm run prettier && cd .. + cd frontend && npm version $(VERSION) --allow-same-version && npm run prettier && cd .. vet: go list -tags "" ./... | grep -v "./vendor/*" | xargs go vet -tags "" diff --git a/build/frontend/Dockerfile b/build/frontend/Dockerfile index 2931c82..63377d8 100644 --- a/build/frontend/Dockerfile +++ b/build/frontend/Dockerfile @@ -10,6 +10,7 @@ COPY frontend/.env.sample .env.production RUN apk add --no-cache libc6-compat RUN npm config delete proxy +RUN npm ci RUN npm run build FROM base AS runner diff --git a/hack/release-tag.sh b/hack/release-tag.sh index dd0d79f..2ba8d22 100755 --- a/hack/release-tag.sh +++ b/hack/release-tag.sh @@ -1,4 +1,4 @@ -#!/bin/bash -xe +#!/bin/bash -e VERSION=$(cat version.txt) @@ -7,12 +7,12 @@ if [[ ! "${VERSION}" =~ ^v([0-9]+[.][0-9]+)[.]([0-9]+)(-(alpha|beta)[.]([0-9]+)) exit 1 fi -if [ "$(git tag -l "${VERSION}")" ]; then - echo "Tag ${VERSION} already exists" - exit 1 -fi +# if [ "$(git tag -l "${VERSION}")" ]; then +# echo "Tag ${VERSION} already exists" +# exit 1 +# fi -git tag -a -m "Release ${VERSION}" "${VERSION}" -git push origin "${VERSION}" +git tag -f -a -m "Release ${VERSION}" "${VERSION}" +git push origin -f "${VERSION}" -echo "release_tag=refs/tags/${VERSION}" >> "$GITHUB_OUTPUT" \ No newline at end of file +echo "release_tag=refs/tags/${VERSION}" \ No newline at end of file