Skip to content

Fix redeclared variables issue #13

Fix redeclared variables issue

Fix redeclared variables issue #13

Workflow file for this run

name: Build Go Binary
on:
workflow_dispatch:
push:
branches:
- master
jobs:
check_changes:
outputs:
run_build: ${{ steps.verify-changed-files.outputs.any_changed }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Verify Changed files
uses: tj-actions/changed-files@v37
id: verify-changed-files
with:
files: |
CHANGELOG.md
create_release:
name: Create Release
runs-on: ubuntu-latest
needs: check_changes
if: needs.check_changes.outputs.run_build == 'true'
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v3
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
body_path: CHANGELOG.md
build:
name: Build
runs-on: ${{ matrix.os }}
needs: [check_changes, create_release]
if: needs.check_changes.outputs.run_build == 'true'
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
go: [1.21.1]
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Check out code
uses: actions/checkout@v3
- name: Download artifact
if: matrix.os == 'windows-latest'
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: llc.yml
workflow_conclusion: success
name: RequiredBinaries
path: ./src/windows
- name: Get dependencies
run: cd ./src && go get -v -t -d ./...
- name: Build
run: go build -v ./src
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: go-binary-${{ matrix.os }}
path: ${{ runner.os == 'Windows' && 'CaffeineC.exe' || 'CaffeineC' }}
- name: upload linux artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ runner.os == 'Windows' && './CaffeineC.exe' || './CaffeineC' }}
asset_name: ${{ runner.os == 'Windows' && 'CaffeineC.exe' || 'CaffeineC' }}
asset_content_type: application/octet-stream