From b2672e0d85bda08b19848d872088cb20c1d848f3 Mon Sep 17 00:00:00 2001 From: DuodenumL Date: Wed, 9 Mar 2022 17:47:49 +0800 Subject: [PATCH] update github action --- .github/workflows/dockerimage.yml | 54 +++++++++++++++++++++++------ .github/workflows/golangci-lint.yml | 13 ++++--- .github/workflows/goreleaser.yml | 4 +-- .github/workflows/test.yml | 2 +- go.mod | 49 +++++++++++++++++++++++++- 5 files changed, 104 insertions(+), 18 deletions(-) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 9c2bb48..d9ce3a6 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -12,24 +12,58 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - - name: build and push to github packages - uses: docker/build-push-action@v1 + - name: Log in to the ghcr + uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - tag_with_ref: true - tag_with_sha: false - - name: build and push to docker hub - uses: docker/build-push-action@v1 + - name: Log in to the docker + uses: docker/login-action@v1 with: - repository: projecteru2/cli username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - tag_with_ref: true - tag_with_sha: false + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: | + ghcr.io/${{ github.repository }} + ${{ github.repository }} + tags: | + type=ref,event=tag + + - name: Docker meta for debug version + if: ${{ github.ref == 'refs/heads/master' }} + id: debug-meta + uses: docker/metadata-action@v3 + with: + images: | + ghcr.io/${{ github.repository }} + ${{ github.repository }} + tags: | + type=sha,format=long,prefix= + + - name: Build and push image + if: ${{ steps.meta.outputs.tags != '' }} + uses: docker/build-push-action@v2 + with: + context: "." + push: true + tags: ${{ steps.meta.outputs.tags }} + + - name: "[debug version] Build and push image" + if: ${{ github.ref == 'refs/heads/master' }} + uses: docker/build-push-action@v2 + with: + context: "." + push: true + build-args: | + KEEP_SYMBOL=1 + tags: ${{ steps.debug-meta.outputs.tags }} diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index bf80c83..fb09f03 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,5 +1,4 @@ name: golangci-lint - on: push: tags: @@ -14,13 +13,19 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17.7 + - name: golangci-lint - uses: golangci/golangci-lint-action@v1 + uses: golangci/golangci-lint-action@v3 env: ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.31 + version: v1.44.2 # Optional: show only new issues if it's a pull request. The default value is `false`. only-new-issues: true diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index d3eec01..897b2c4 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 @@ -21,7 +21,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.17.7 - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ca1db4e..292da16 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,6 @@ jobs: container: projecteru2/footstone:latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: unit tests run: make test diff --git a/go.mod b/go.mod index 3689515..e0a90a6 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/projecteru2/cli -go 1.14 +go 1.17 require ( github.com/containerd/containerd v1.4.12 // indirect @@ -25,3 +25,50 @@ require ( golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 gopkg.in/yaml.v2 v2.4.0 ) + +require ( + github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect + github.com/BurntSushi/toml v0.3.1 // indirect + github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331 // indirect + github.com/Microsoft/hcsshim v0.8.11 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cenkalti/backoff/v4 v4.0.2 // indirect + github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59 // indirect + github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect + github.com/docker/distribution v2.7.1+incompatible // indirect + github.com/docker/docker v20.10.0+incompatible // indirect + github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-metrics v0.0.1 // indirect + github.com/getsentry/sentry-go v0.9.0 // indirect + github.com/go-ping/ping v0.0.0-20210407214646-e4e642a95741 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/gorilla/mux v1.7.4 // indirect + github.com/jinzhu/configor v1.2.0 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/moby/sys/mount v0.2.0 // indirect + github.com/moby/sys/mountinfo v0.4.1 // indirect + github.com/moby/term v0.0.0-20201110203204-bea5bbe245bf // indirect + github.com/morikuni/aec v1.0.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.0.2 // indirect + github.com/patrickmn/go-cache v2.1.0+incompatible // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/prometheus/client_golang v1.11.0 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.26.0 // indirect + github.com/prometheus/procfs v0.6.0 // indirect + github.com/russross/blackfriday/v2 v2.0.1 // indirect + github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect + go.opencensus.io v0.22.1 // indirect + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect + golang.org/x/text v0.3.5 // indirect + google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect + google.golang.org/grpc v1.40.0 // indirect + google.golang.org/protobuf v1.27.1 // indirect +)