Skip to content

Commit

Permalink
feat: add release pipeline (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
devigned committed Dec 5, 2019
1 parent e616fba commit 81f1690
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 3 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: release

jobs:
build:
name: tag release
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@master
- name: Set env
run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10})
- name: make gox
env:
VERSION: ${{ env.RELEASE_VERSION }}
SHORT_VERSION: ${{ env.RELEASE_VERSION }}
run: |
make gox
- name: create github release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: upload linux-amd64
id: upload-linux-amd64
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/${{ env.RELEASE_VERSION }}/apmz_linux_amd64.tar.gz
asset_name: apmz_${{ env.RELEASE_VERSION }}_linux_amd64.tar.gz
asset_content_type: application/gzip
- name: upload darwin-amd64
id: upload-darwin-amd64
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/${{ env.RELEASE_VERSION }}/apmz_darwin_amd64.tar.gz
asset_name: apmz_${{ env.RELEASE_VERSION }}_darwin_amd64.tar.gz
asset_content_type: application/gzip
- name: upload windows-amd64
id: upload-windows-amd64
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/${{ env.RELEASE_VERSION }}/apmz_windows_amd64.tar.gz
asset_name: apmz_${{ env.RELEASE_VERSION }}_windows_amd64.tar.gz
asset_content_type: application/gzip
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ test-cover: install-tools ; $(info $(M) running go test…)
.PHONY: gox
gox: install-tools
$(Q) gox -osarch="darwin/amd64 windows/amd64 linux/amd64" -ldflags "-X $(PACKAGE)/cmd.GitCommit=$(VERSION)" -output "./bin/$(SHORT_VERSION)/{{.Dir}}_{{.OS}}_{{.Arch}}"
$(Q) tar -czvf ./bin/$(SHORT_VERSION)/pub_darwin_amd64.tar.gz -C ./bin/$(SHORT_VERSION)/ pub_darwin_amd64
$(Q) tar -czvf ./bin/$(SHORT_VERSION)/pub_linux_amd64.tar.gz -C ./bin/$(SHORT_VERSION)/ pub_linux_amd64
$(Q) tar -czvf ./bin/$(SHORT_VERSION)/pub_windows_amd64.tar.gz -C ./bin/$(SHORT_VERSION)/ pub_windows_amd64.exe
$(Q) tar -czvf ./bin/$(SHORT_VERSION)/$(APP)_darwin_amd64.tar.gz -C ./bin/$(SHORT_VERSION)/ $(APP)_darwin_amd64
$(Q) tar -czvf ./bin/$(SHORT_VERSION)/$(APP)_linux_amd64.tar.gz -C ./bin/$(SHORT_VERSION)/ $(APP)_linux_amd64
$(Q) tar -czvf ./bin/$(SHORT_VERSION)/$(APP)_windows_amd64.tar.gz -C ./bin/$(SHORT_VERSION)/ $(APP)_windows_amd64.exe

.PHONY: ci
ci: install-tools fmt lint vet tidy build test-cover

0 comments on commit 81f1690

Please sign in to comment.