Skip to content

Build

Build #1043

Workflow file for this run

name: Build
on:
push:
tags:
- v*
branches:
- master
- v*
- dev*
- ci*
- feat*
- fix*
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
- ".github/workflows/*.yml"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goos: [ linux, darwin ]
goarch: [ amd64, arm64 ]
include:
- goos: windows
goarch: amd64
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: '0'
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.19.2
check-latest: true
cache: true
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Download dependencies
run: go mod download
- name: Build
run: go build -v -ldflags '-s -w -buildid=' -trimpath -o out/murphysec-${{ matrix.goos }}-${{ matrix.goarch }}
- name: Rename for Windows
if: matrix.goos == 'windows'
run: mv out/murphysec-${{ matrix.goos }}-${{ matrix.goarch }} out/murphysec-${{ matrix.goos }}-${{ matrix.goarch }}.exe
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: murphysec-${{ matrix.goos }}-${{ matrix.goarch }}
path: out/*
merge:
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: murphysec-linux-amd64
- uses: actions/download-artifact@v3
with:
name: murphysec-linux-arm64
- uses: actions/download-artifact@v3
with:
name: murphysec-windows-amd64
- uses: actions/download-artifact@v3
with:
name: murphysec-darwin-arm64
- uses: actions/download-artifact@v3
with:
name: murphysec-darwin-amd64
- name: 7zip
run: 7z a bundle.7z -mx=9 -ms=on murphy*
- run: ls -alh
if: always()
- name: Upload artifacts - 7zip-bundle
uses: actions/upload-artifact@v3
with:
name: 7zip-bundle
path: ./bundle.7z
release:
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- name: Show files
run: |
pwd
find
- name: Calc hash
run: |
mkdir -p out
cp ./murphysec-linux-amd64/murphysec-linux-amd64 ./out/
cp ./murphysec-windows-amd64/murphysec-windows-amd64.exe ./out/
cp ./murphysec-darwin-amd64/murphysec-darwin-amd64 ./out/
cp ./murphysec-darwin-arm64/murphysec-darwin-arm64 ./out
cp ./murphysec-linux-arm64/murphysec-linux-arm64 ./out
cd out
sha256sum * > sha256sum
- name: Release
uses: softprops/action-gh-release@v1
with:
files: out/*
draft: true