Chore: update actions

This commit is contained in:
xjasonlyu
2021-07-16 17:05:53 +08:00
parent 991ad5a967
commit 5e90e34f93
3 changed files with 71 additions and 40 deletions

View File

@@ -3,12 +3,12 @@ name: Publish Docker Image
on: on:
push: push:
branches: branches:
- dev - 'main'
tags: tags:
- '*' - '*'
paths-ignore: paths-ignore:
- 'docs/**'
- '**.md' - '**.md'
- 'docs/**'
jobs: jobs:
@@ -45,21 +45,21 @@ jobs:
username: xjasonlyu username: xjasonlyu
password: ${{ secrets.CR_PAT }} password: ${{ secrets.CR_PAT }}
- name: Build and Push (dev) - name: Get Version
if: github.ref == 'refs/heads/dev' id: shell
run: |
echo ::set-output name=version::$(git describe --tags --abbrev=0)
- name: Build and Push (nightly)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
push: true push: true
platforms: linux/amd64,linux/arm/v7,linux/arm64 platforms: linux/amd64,linux/arm/v7,linux/arm64
tags: | tags: |
xjasonlyu/tun2socks:dev xjasonlyu/tun2socks:nightly
ghcr.io/xjasonlyu/tun2socks:dev ghcr.io/xjasonlyu/tun2socks:nightly
- name: Get Version
id: shell
run: |
echo ::set-output name=version::$(git describe --tags --abbrev=0)
- name: Build and Push (latest) - name: Build and Push (latest)
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')

View File

@@ -1,32 +1,24 @@
name: Go name: Go Static Check
on: on:
pull_request:
push: push:
branches: pull_request:
- dev
tags:
- '*'
paths-ignore:
- 'docs/**'
- 'docker/**'
- '**.md'
jobs: jobs:
build: build:
name: Build name: Build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Cache go module - name: Cache go module
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
@@ -41,17 +33,3 @@ jobs:
go vet ./... go vet ./...
go install honnef.co/go/tools/cmd/staticcheck@latest go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck -- $(go list ./...) staticcheck -- $(go list ./...)
- name: Build
if: startsWith(github.ref, 'refs/tags/')
run: make -j releases
- name: Upload Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: build/*
draft: true
prerelease: false

53
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: Publish Go Releases
on:
push:
branches:
- 'main'
tags:
- '*'
paths-ignore:
- '**.md'
- 'docs/**'
- 'docker/**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Build
run: make -j releases
- name: Upload Releases (nightly)
uses: softprops/action-gh-release@v1
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: build/*
draft: false
prerelease: true
name: Nightly Build
tag_name: nightly
body: Automatically Released by Actions.
- name: Upload Releases
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: build/*
draft: true
prerelease: false