Browse Source

Chore: update actions

pull/76/head
xjasonlyu 3 years ago
parent
commit
5e90e34f93
  1. 22
      .github/workflows/docker.yml
  2. 36
      .github/workflows/go.yml
  3. 53
      .github/workflows/release.yml

22
.github/workflows/docker.yml

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

36
.github/workflows/go.yml

@ -1,32 +1,24 @@
name: Go
name: Go Static Check
on:
pull_request:
push:
branches:
- dev
tags:
- '*'
paths-ignore:
- 'docs/**'
- 'docker/**'
- '**.md'
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- 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: Cache go module
uses: actions/cache@v2
with:
@ -41,17 +33,3 @@ jobs:
go vet ./...
go install honnef.co/go/tools/cmd/staticcheck@latest
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

@ -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
Loading…
Cancel
Save