Update README.md #26
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
name: Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^1.16 | |
- name: Get the version | |
id: get_version | |
run: echo "VERSION=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null)" >> $GITHUB_ENV | |
- name: Generate release notes | |
id: release_notes | |
run: | | |
echo 'Release Notes' > RELEASE_NOTES.md | |
echo '' >> RELEASE_NOTES.md | |
git log --pretty=format:"- %s" >> RELEASE_NOTES.md | |
echo "body=$(cat RELEASE_NOTES.md | base64)" >> $GITHUB_ENV | |
- name: Bump version and push tag | |
id: bump_version | |
uses: anothrNick/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.API_TOKEN }} | |
WITH_V: true | |
DEFAULT_BUMP: minor | |
- name: Build Linux release | |
run: | | |
GOOS=linux GOARCH=amd64 go build -v -ldflags "-X main.version=${{ steps.bump_version.outputs.new_tag }}" -o bin/shadowguard-linux ./cmd | |
- name: Build macOS release | |
run: | | |
GOOS=darwin GOARCH=amd64 go build -v -ldflags "-X main.version=${{ steps.bump_version.outputs.new_tag }}" -o bin/shadowguard-macos ./cmd | |
- name: Build Windows release | |
run: | | |
GOOS=windows GOARCH=amd64 go build -v -ldflags "-X main.version=${{ steps.bump_version.outputs.new_tag }}" -o bin/shadowguard.exe ./cmd | |
- name: Print new version | |
run: echo "The new version is ${{ steps.bump_version.outputs.new_tag }}" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.API_TOKEN }} | |
with: | |
tag_name: ${{ steps.bump_version.outputs.new_tag }} | |
release_name: Release ${{ steps.bump_version.outputs.new_tag }} | |
body: ${{ steps.run_script.outputs.stdout }} | |
draft: false | |
prerelease: false | |
- name: Upload Linux Asset | |
id: upload_linux_asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.API_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./bin/shadowguard-linux | |
asset_name: shadowguard-linux-${{ steps.bump_version.outputs.new_tag }} | |
asset_content_type: application/octet-stream | |
- name: Upload macOS Asset | |
id: upload_macos_asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.API_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./bin/shadowguard-macos | |
asset_name: shadowguard-macos-${{ steps.bump_version.outputs.new_tag }} | |
asset_content_type: application/octet-stream | |
- name: Upload Windows Asset | |
id: upload_windows_asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.API_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./bin/shadowguard.exe | |
asset_name: shadowguard-windows-${{ steps.bump_version.outputs.new_tag }}.exe | |
asset_content_type: application/octet-stream |