Fix wrong executable naming #23
Workflow file for this run
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: Go Build and Release | |
# on: | |
# push: | |
# tags: | |
# - 'v*' | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- OS: linux | |
ARCH: amd64 | |
EXT: "bin" | |
- OS: windows | |
ARCH: amd64 | |
EXT: "exe" | |
- OS: darwin | |
ARCH: amd64 | |
EXT: "app" | |
- OS: darwin | |
ARCH: arm64 | |
EXT: "app" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Build | |
run: | | |
GOOS=${{ matrix.OS }} GOARCH=${{ matrix.ARCH }} | |
go build -v -o mediarizer2-${{ matrix.OS }}-${{ matrix.ARCH }}.${{ matrix.EXT }} ./app | |
env: | |
GOOS: ${{ matrix.OS }} | |
GOARCH: ${{ matrix.ARCH }} | |
EXT: ${{ matrix.EXT }} | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mediarizer2-${{ matrix.OS }}-${{ matrix.ARCH }}.${{ matrix.EXT }} | |
path: mediarizer2-${{ matrix.OS }}-${{ matrix.ARCH }}.${{ matrix.EXT }} | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
# if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fetch Tags | |
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Get commits since last tag | |
id: get_commits | |
run: | | |
LATEST_TAG=$(git describe --tags --abbrev=0 --always) | |
if [ -z "$LATEST_TAG" ] || [[ "$LATEST_TAG" == *"$GITHUB_SHA"* ]]; then | |
LATEST_TAG=$(git rev-list --max-parents=0 HEAD) | |
fi | |
COMMIT_MESSAGES=$(git log $LATEST_TAG..HEAD --pretty=format:"%h - %s") | |
echo "::set-output name=commits::$COMMIT_MESSAGES" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.run_number }} | |
release_name: Release ${{ github.ref_name }} (${{ github.run_number }}) | |
body: | | |
- Commits included: | |
${{ steps.get_commits.outputs.commits }} | |
draft: false | |
prerelease: false | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ./ | |
- name: Upload Release Assets | |
run: | | |
for file in mediarizer2-*; do | |
echo "Uploading $file" | |
asset_name=$(basename $file) | |
echo "Asset Name: $asset_name" | |
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/octet-stream" --data-binary @$file ${{ steps.create_release.outputs.upload_url }}?name=$asset_name | |
done |