forked from nkanaev/yarr
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
138 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,145 @@ | ||
name: goreleaser | ||
name: build | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
contents: write | ||
tags: ['v*', 'test*'] | ||
|
||
jobs: | ||
goreleaser: | ||
build_macos: | ||
name: Build for MacOS | ||
runs-on: macos-10.15 | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
- name: "Setup Go" | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.16' | ||
- name: Cache Go Modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: "Build" | ||
run: make build_macos | ||
- name: Upload | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: macos | ||
path: _output/macos/yarr.app | ||
|
||
build_windows: | ||
name: Build for Windows | ||
runs-on: windows-2019 | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
- name: "Setup Go" | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.16' | ||
- name: Cache Go Modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: "Build" | ||
run: make build_windows | ||
- name: Upload | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: windows | ||
path: _output/windows/yarr.exe | ||
|
||
build_linux: | ||
name: Build for Linux | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
- name: "Setup Go" | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.16' | ||
- name: Cache Go Modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: "Build" | ||
run: make build_linux | ||
- name: Upload | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: linux | ||
path: _output/linux/yarr | ||
|
||
create_release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
if: ${{ !contains(github.ref, 'test') }} | ||
needs: [build_macos, build_windows, build_linux] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: git fetch --force --tags | ||
- name: Set up Go | ||
uses: actions/[email protected] | ||
with: | ||
cache: true | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create Release | ||
uses: actions/create-release@v1 | ||
id: create_release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
draft: true | ||
prerelease: true | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: . | ||
- name: Preparation | ||
run: | | ||
ls -R | ||
chmod u+x macos/Contents/MacOS/yarr | ||
chmod u+x linux/yarr | ||
mv macos yarr.app && zip -r yarr-macos.zip yarr.app | ||
mv windows/yarr.exe . && zip yarr-windows.zip yarr.exe | ||
mv linux/yarr . && zip yarr-linux.zip yarr | ||
- name: Upload MacOS | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./yarr-macos.zip | ||
asset_name: yarr-${{ github.ref }}-macos64.zip | ||
asset_content_type: application/zip | ||
- name: Upload Windows | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./yarr-windows.zip | ||
asset_name: yarr-${{ github.ref }}-windows64.zip | ||
asset_content_type: application/zip | ||
- name: Upload Linux | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./yarr-linux.zip | ||
asset_name: yarr-${{ github.ref }}-linux64.zip | ||
asset_content_type: application/zip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
VERSION=2.3 | ||
VERSION=1.0 | ||
GITHASH=$(shell git rev-parse --short=8 HEAD) | ||
|
||
CGO_ENABLED=1 | ||
|