Skip to content

changelog update

changelog update #6

name: release
on:
push:
tags:
- '*'
env:
APP_NAME: 'merged-branches'
GO_VERSION: '1.20.2'
jobs:
build-artifact:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# - os: ubuntu-latest
# asset_name_suffix: linux
# - os: windows-latest
# asset_name_suffix: windows.exe
- os: macOS-latest
asset_name_suffix: macOS
steps:
- uses: actions/checkout@v3
- name: Build-${{ runner.os }}
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- run: |
RELEASE_VERSION=${GITHUB_REF#refs/*/}
go build -ldflags "-X main.Version=${RELEASE_VERSION} -X main.Platform=${{ matrix.asset_name_suffix }}" -o ${{ env.APP_NAME }}_${{ matrix.os }}
- name: Create artifact
uses: actions/upload-artifact@v3
with:
name: artifact-${{ matrix.os }}
path: ${{ env.APP_NAME }}_${{ matrix.os }}
create-release:
runs-on: ubuntu-latest
needs:
- build-artifact
steps:
- uses: actions/checkout@v3
- name: Create Release
id: create-release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
artifacts: "${{ env.APP_NAME }}_*"
body: ""
draft: false
generateReleaseNotes: true
- name: Write upload_url to file
run: echo '${{ steps.create-release.outputs.upload_url }}' > upload_url.txt
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: create-release
path: upload_url.txt
upload-release:
runs-on: ubuntu-latest
needs: create-release
strategy:
matrix:
include:
# - os: ubuntu-latest
# asset_name_suffix: linux
# asset_content_type: application/x-pie-executable
# - os: windows-latest
# asset_name_suffix: windows.exe
# asset_content_type: application/x-dosexec
- os: macOS-latest
asset_name_suffix: macos
asset_content_type: application/x-mach-binary
steps:
- uses: actions/download-artifact@v3
with:
name: artifact-${{ matrix.os }}
- uses: actions/download-artifact@v3
with:
name: create-release
- id: vars
run: |
echo "::set-output name=upload_url::$(cat upload_url.txt)"
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.vars.outputs.upload_url }}
asset_path: ${{ env.APP_NAME }}_${{ matrix.os }}
asset_name: ${{ env.APP_NAME }}_${{ matrix.asset_name_suffix }}
asset_content_type: ${{ matrix.asset_content_type }}