-
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.
Merge pull request #21 from StevenMaude/github-actions-build-releases
Build releases with GitHub Actions
- Loading branch information
Showing
7 changed files
with
98 additions
and
11 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
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,70 @@ | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
name: Build and release binary | ||
|
||
jobs: | ||
build: | ||
name: Build and release binary | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build Linux binary | ||
run: | | ||
make build-linux | ||
- name: Build Windows binary | ||
run: | | ||
make build-windows | ||
- name: Calculate SHA256 | ||
run: | | ||
sha256sum go-mailin8_linux_amd64 go-mailin8.exe > SHA256SUMS | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
draft: true | ||
prerelease: false | ||
|
||
- name: Upload Linux binary to GitHub | ||
id: upload-linux-binary | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./go-mailin8_linux_amd64 | ||
asset_name: go-mailin8_linux_amd64 | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Windows binary to GitHub | ||
id: upload-windows-binary | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./go-mailin8.exe | ||
asset_name: go-mailin8.exe | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload SHA256SUMS to GitHub | ||
id: upload-sha256sums | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./SHA256SUMS | ||
asset_name: SHA256SUMS | ||
asset_content_type: text/plain |
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 +1,3 @@ | ||
/go-mailin8 | ||
# Compiled binaries | ||
/go-mailin8_linux_amd64 | ||
/go-mailin8.exe |
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
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,6 +1,10 @@ | ||
build: | ||
build-linux: | ||
docker build . -t go-mailin8 | ||
docker run --rm --entrypoint cat go-mailin8 /go/bin/go-mailin8 > go-mailin8 | ||
chmod u+x go-mailin8 | ||
docker run --rm --entrypoint cat go-mailin8 /go/bin/go-mailin8 > go-mailin8_linux_amd64 | ||
chmod u+x go-mailin8_linux_amd64 | ||
|
||
.PHONY: build | ||
build-windows: | ||
docker build --build-arg GOOS=windows . -t go-mailin8 | ||
docker run --rm --entrypoint cat go-mailin8 /go/bin/windows_amd64/go-mailin8.exe > go-mailin8.exe | ||
|
||
.PHONY: build-linux build-windows |
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
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