-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use github actions for binary and docker releases
- Loading branch information
1 parent
b5ae116
commit 819a32d
Showing
1 changed file
with
87 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
name: Release | ||
|
||
jobs: | ||
build: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Set up Go 1.15.6 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.15.6 | ||
id: go | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@master | ||
|
||
- name: build linux | ||
run: GOOS=linux go build -a -v -installsuffix cgo -ldflags="-w -s" -o alert2gsm-linux . | ||
|
||
- name: build darwin | ||
run: GOOS=darwin go build -a -v -installsuffix cgo -ldflags="-w -s" -o alert2gsm-darwin . | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: crazy-max/ghaction-docker-buildx@v1 | ||
with: | ||
version: latest | ||
|
||
- name: docker hub login | ||
env: | ||
HUB_PASSWORD: ${{ secrets.HUB_PASSWORD }} | ||
run: docker login -u egeneralov -p ${HUB_PASSWORD} | ||
|
||
- name: docker build+push | ||
run: docker buildx build -t ${GITHUB_REPOSITORY}:$(echo $GITHUB_REF | awk -F \/ '{print $3}') --platform linux/amd64,linux/arm64,linux/arm/v7 --output "type=image,push=true" . | ||
|
||
- name: docker hub logout | ||
run: docker logout | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: save linux artifact in Actions | ||
uses: actions/[email protected] | ||
with: | ||
name: linux | ||
path: alert2gsm-linux | ||
|
||
- name: save darwin artifact in Actions | ||
uses: actions/[email protected] | ||
with: | ||
name: darwin | ||
path: alert2gsm-darwin | ||
|
||
- name: upload linux release asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./alert2gsm-linux | ||
asset_name: alert2gsm-linux | ||
asset_content_type: application/binary | ||
|
||
- name: upload darwin release asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./alert2gsm-darwin | ||
asset_name: alert2gsm-darwin | ||
asset_content_type: application/binary |