ci: fix build error (#314)

This commit is contained in:
nadoo 2022-03-11 13:10:59 +08:00
parent 1b972af52c
commit d68f361c35

View File

@ -5,6 +5,7 @@ on:
- 'dev' - 'dev'
tags: tags:
- '*' - '*'
pull_request:
env: env:
APP_NAME: glider APP_NAME: glider
@ -18,7 +19,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
@ -28,11 +29,10 @@ jobs:
echo "GO_MOD_VERSION=$(grep -P "go \d+\." go.mod | cut -d " " -f2)" >> $GITHUB_ENV echo "GO_MOD_VERSION=$(grep -P "go \d+\." go.mod | cut -d " " -f2)" >> $GITHUB_ENV
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v3
with: with:
stable: false
check-latest: true check-latest: true
go-version: '1.18.0-rc1' go-version: '1.18.0-rc.1'
# go-version: ${{ env.GO_MOD_VERSION}} # go-version: ${{ env.GO_MOD_VERSION}}
- name: Set up Cache - name: Set up Cache
@ -58,7 +58,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Artifact - Linux amd64 - name: Upload Artifact - Linux amd64
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
if: "!startsWith(github.ref, 'refs/tags/')" if: "!startsWith(github.ref, 'refs/tags/')"
with: with:
name: ${{ env.APP_NAME }}-dev-${{ env.SHA_SHORT }}-linux-amd64 name: ${{ env.APP_NAME }}-dev-${{ env.SHA_SHORT }}-linux-amd64
@ -66,7 +66,7 @@ jobs:
./dist/default_linux_amd64/${{ env.APP_NAME }} ./dist/default_linux_amd64/${{ env.APP_NAME }}
- name: Upload Artifact - Linux arm64 - name: Upload Artifact - Linux arm64
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
if: "!startsWith(github.ref, 'refs/tags/')" if: "!startsWith(github.ref, 'refs/tags/')"
with: with:
name: ${{ env.APP_NAME }}-dev-${{ env.SHA_SHORT }}-linux-arm64 name: ${{ env.APP_NAME }}-dev-${{ env.SHA_SHORT }}-linux-arm64
@ -74,7 +74,7 @@ jobs:
./dist/default_linux_arm64/${{ env.APP_NAME }} ./dist/default_linux_arm64/${{ env.APP_NAME }}
- name: Upload Artifact - macOS arm64 - name: Upload Artifact - macOS arm64
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
if: "!startsWith(github.ref, 'refs/tags/')" if: "!startsWith(github.ref, 'refs/tags/')"
with: with:
name: ${{ env.APP_NAME }}-dev-${{ env.SHA_SHORT }}-macos-arm64 name: ${{ env.APP_NAME }}-dev-${{ env.SHA_SHORT }}-macos-arm64
@ -82,7 +82,7 @@ jobs:
./dist/default_darwin_arm64/${{ env.APP_NAME }} ./dist/default_darwin_arm64/${{ env.APP_NAME }}
- name: Upload Artifact - Windows amd64 - name: Upload Artifact - Windows amd64
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
if: "!startsWith(github.ref, 'refs/tags/')" if: "!startsWith(github.ref, 'refs/tags/')"
with: with:
name: ${{ env.APP_NAME }}-dev-${{ env.SHA_SHORT }}-windows-amd64 name: ${{ env.APP_NAME }}-dev-${{ env.SHA_SHORT }}-windows-amd64
@ -98,19 +98,20 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Docker - Set up Buildx - name: Docker - Set up Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Docker - Login to DockerHub - name: Docker - Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker - Login to GHCR - name: Docker - Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
registry: ghcr.io registry: ghcr.io
@ -128,12 +129,13 @@ jobs:
type=ref,event=branch type=ref,event=branch
type=semver,pattern={{version}} type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}}
- name: Docker - Build and push - name: Docker - Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
file: .Dockerfile file: .Dockerfile
platforms: ${{ env.PLATFORMS }} platforms: ${{ env.PLATFORMS }}
push: true push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}