Compare commits

..

3 Commits

Author SHA1 Message Date
dexter
9e876fb424 Update go.yml 2022-04-17 12:16:45 +08:00
dexter
7533d83ae7 Merge pull request #40 from dwdcth/3.0
goreleaser ci
2022-04-17 11:42:02 +08:00
dwdcth
69a61a77bd goreleaser ci 2022-04-13 16:54:34 +08:00
2 changed files with 74 additions and 67 deletions

106
.github/workflows/go.yml vendored Normal file → Executable file
View File

@@ -3,90 +3,62 @@ name: Go
on:
create:
tags:
- v*
- v3*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Build
run: go build -o m7s_linux_x86_64
- name: Tar
run: tar -zcvf linux.tgz m7s_linux_x86_64 config.toml
- name: Deploy
- name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: runner.osgo{ { hashFiles('**/go.sum') } }
restore-keys: ${{ runner.os }}-go-
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy Windows
uses: garygrossgarten/github-action-scp@release
with:
local: /home/runner/work/monibuca/monibuca/linux.tgz
remote: /opt/dexter/linux.tgz
host: monibuca.com
username: root
privateKey: ${{ secrets.PEM }}
- name: Release
uses: softprops/action-gh-release@v1
with:
files: "linux.tgz"
build2:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
local: dist/m7s_${GITHUB_REF:11}_windows_amd64.tar.gz
remote: /opt/dexter/windows.tgz
host: monibuca.com
username: root
privateKey: ${{ secrets.PEM }}
- name: Build
run: go build -o m7s_x86_64.exe
- name: Tar
run: tar -zcvf windows.tgz m7s_x86_64.exe config.toml
- name: Deploy
- name: Deploy Mac
uses: garygrossgarten/github-action-scp@release
with:
local: D:\\a\\monibuca\\monibuca\\windows.tgz
remote: /opt/dexter/windows.tgz
host: monibuca.com
username: root
privateKey: ${{ secrets.PEM }}
- name: Release
uses: softprops/action-gh-release@v1
with:
files: "windows.tgz"
build3:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
local: dist/m7s_${GITHUB_REF:11}_darwin_amd64.tar.gz
remote: /opt/dexter/mac.tgz
host: monibuca.com
username: root
privateKey: ${{ secrets.PEM }}
- name: Build
run: go build -o m7s_darwin_x86_64
- name: Tar
run: tar -zcvf mac.tgz m7s_darwin_x86_64 config.toml
- name: Deploy
- name: Deploy Linux
uses: garygrossgarten/github-action-scp@release
with:
local: /Users/runner/work/monibuca/monibuca/mac.tgz
remote: /opt/dexter/mac.tgz
host: monibuca.com
username: root
privateKey: ${{ secrets.PEM }}
- name: Release
uses: softprops/action-gh-release@v1
with:
files: "mac.tgz"
local: dist/m7s_${GITHUB_REF:11}_linux_amd64.tar.gz
remote: /opt/dexter/linux.tgz
host: monibuca.com
username: root
privateKey: ${{ secrets.PEM }}

35
goreleaser.yml Executable file
View File

@@ -0,0 +1,35 @@
project_name: m7s
archives:
-
files:
- config.toml
builds:
- env: [CGO_ENABLED=0]
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
#dockers:
# - image_templates: ["ghcr.io/goreleaser/example:{{ .Version }}"]
# dockerfile: Dockerfile
# build_flag_templates:
# - --label=org.opencontainers.image.title={{ .ProjectName }}
# - --label=org.opencontainers.image.description={{ .ProjectName }}
# - --label=org.opencontainers.image.url=https://github.com/goreleaser/example
# - --label=org.opencontainers.image.source=https://github.com/goreleaser/example
# - --label=org.opencontainers.image.version={{ .Version }}
# - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
# - --label=org.opencontainers.image.revision={{ .FullCommit }}
# - --label=org.opencontainers.image.licenses=MIT
#nfpms:
# - maintainer: Carlos A Becker <root@carlosbecker.dev>
# description: Sample project.
# homepage: https://github.com/caarlos0/tasktimer
# license: MIT
# formats:
# - deb
# - rpm
# - apk