init goreleaser (#169)

* init goreleaser

add dockerfile

add fetch tag

set next to snapshot

remove generate

skip val

add auto ver

revert ver

revert ver

force tag

* self tag

* self tag

* always tag

* change perm

* final
This commit is contained in:
Boshi Lian 2023-08-02 02:40:04 -07:00 committed by GitHub
parent 3a8de2746e
commit fefbb0ec99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 303 additions and 18 deletions

View file

@ -4,7 +4,6 @@ on:
push:
branches: [ master ]
pull_request:
types: [assigned, opened, synchronize, reopened]
jobs:

View file

@ -1,8 +1,6 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- master
pull_request:

69
.github/workflows/release.yaml vendored Normal file
View file

@ -0,0 +1,69 @@
name: Release
on:
push:
branches: [ master ]
release:
types: [ released ]
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0
submodules: 'recursive'
- uses: dotnet/nbgv@master
with:
setAllVars: true
- run: git tag v$NBGV_SimpleVersion || true
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry docker hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: 'stable'
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SKIP_PUSH: ${{ github.event_name != 'release' }}
GORELEASER_CURRENT_TAG: v${{ env.NBGV_SimpleVersion }}
- run: gh release list | grep Draft | tail -n +3 | cut -f 1 | xargs -r -L 1 gh release delete --yes

View file

@ -4,18 +4,19 @@ on:
push:
branches: [ master ]
pull_request:
types: [assigned, opened, synchronize, reopened]
permissions:
contents: read
jobs:
build:
test-and-lint:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up Go 1.x
@ -24,10 +25,6 @@ jobs:
go-version: 'stable'
cache: true
- uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Test lib ssh
run: go test -v -cover ./...
working-directory: crypto/ssh
@ -35,10 +32,9 @@ jobs:
- name: Test sshpiper
run: go test -v -race -cover -tags full ./...
- name: create release
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=60m -E gofmt --verbose --print-resources-usage --build-tags full
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.ref == 'refs/heads/master'
run: |
gh release create -d --generate-notes v$NBGV_SimpleVersion
gh release list | grep Draft | tail -n +3 | cut -f 1 | xargs -r -L 1 gh release delete --yes
GOGC: "10"